What is the difference between the Cache.Add() and Cache.Insert() methods?
Cache.Add()
Cache.Insert()
In which situations should I use each one?
Insert will overwrite an existing cached value with the same Key; Add fails (does nothing) if there is an existing cached value with the same key. So there's a case for saying you should always use Insert since the first time the code runs it will put your object into the cache and when it runs subsequently it will update the cached value.
Insert
Add
1.4m articles
1.4m replys
5 comments
57.0k users