HttpContext.Current.Cache.Add method adds the specified item to the Cache object, whereas HttpContext.Current.Cache.Insert method inserts an item into the Cache object.
The main difference between these two methods is that if an object with the same name already exists in the cache, the Insert method call will replace the object, whereas the Add method call will fail.
The other main difference is also that with the Add method some parameters are mandatory, whereas with Insert method, various overloaded methods are available, and some parameters will be set to default values like the absolute or sliding expirations.
© 2020 Digcode.com. All rights reserved.