public static IDictionary <string, T> GetDistributedCache <T>(IEnumerable <string> cacheKeyList) { if (cacheKeyList == null || cacheKeyList.Count() <= 0) { return(new Dictionary <string, T>(0)); } return(MemcachedCacheHelper.Get <T>(cacheKeyList.ToArray())); }
public static T GetWithDistributedCache <T>(string cacheKey, Func <T> getter, bool absoluteExpiration = true, int cacheExpirationMinutes = 30, string groupName = null) { bool found; object t = MemcachedCacheHelper.Get(cacheKey, out found); if (found) { return((T)t); } T data = getter(); if (absoluteExpiration) { MemcachedCacheHelper.Set(cacheKey, data, DateTime.Now.AddMinutes(cacheExpirationMinutes), groupName); } else { MemcachedCacheHelper.Set(cacheKey, data, TimeSpan.FromMinutes(cacheExpirationMinutes), groupName); } return(data); }
public static T GetDistributedCache <T>(string cacheKey, out bool found) { return(MemcachedCacheHelper.Get <T>(cacheKey, out found)); }
public static T GetDistributedCache <T>(string cacheKey) { return(MemcachedCacheHelper.Get <T>(cacheKey)); }