public static TValue GetOrStore <TValue>(this System.Runtime.Caching.ObjectCache cache, string key, Func <TValue> create, TimeSpan slidingExpiration) { return(cache.GetOrStore(key, create, System.Runtime.Caching.ObjectCache.InfiniteAbsoluteExpiration, slidingExpiration)); }
public static TValue GetOrStore <TValue>(this System.Runtime.Caching.ObjectCache cache, string key, Func <TValue> create, DateTime absoluteExpiration) { return(cache.GetOrStore(key, create, absoluteExpiration, System.Runtime.Caching.ObjectCache.NoSlidingExpiration)); }
public static TValue GetOrStoreAndNotRemove <TValue>(this System.Runtime.Caching.ObjectCache cache, string key, Func <TValue> create) { return(cache.GetOrStore(key, create, System.Runtime.Caching.MemoryCache.InfiniteAbsoluteExpiration, System.Runtime.Caching.MemoryCache.NoSlidingExpiration)); }
public static TValue GetOrStore <TValue>(this System.Runtime.Caching.ObjectCache cache, string key, Func <TValue> create) { return(cache.GetOrStore(key, create, DateTime.Now.AddHours(2), new TimeSpan(1, 0, 0))); }