コード例 #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));
 }
コード例 #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));
 }
コード例 #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));
 }
コード例 #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)));
 }