Esempio n. 1
0
 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));
 }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
 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));
 }
Esempio n. 4
0
 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)));
 }