What is the difference between the Cache.Add()
and Cache.Insert()
methods?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With