With multiple ways to add items to cache, it can be confusing to know which one way is the best. The answer relies on your scenario. For example, these 3 lines of code all add items to cache.
Cache["MyData"] = myObject;Cache.Add("MyData", myObject, null, DateTime.MaxValue, TimeSpan.FromHours(1), Caching.CacheItemPriority.Low, OnRemoveCallback);Cache.Insert("MyData", myObject, null, DateTime.MaxValue, TimeSpan.FromHours(1));
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2009 MuellerDesigns.net
Sign In