MemoryCache

suggest change
//Get instance of cache
using System.Runtime.Caching;

var cache = MemoryCache.Default;

//Check whether the cache contains an item
cache.Contains("CacheKey");

//get item from cache
var item = cache.Get("CacheKey");

//get item from cache or add item if not existing
object list = MemoryCache.Default.AddOrGetExisting("CacheKey", "object to be stored", DateTime.Now.AddHours(12));

//If the item does not exist, this method adds it and returns null.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents