public virtual ICacheItem <T> GetItem <T>(string key) { try { return(IsDisabled ? null : _cache.Get <T>(key)); } catch (Exception e) { throw new CacheServiceException(string.Format("Error searching item key {0} in cache {1}", key, CacheId), e); } }
bool ICacheable.GetFromCache(ICacheEngine cacheEngine, CacheKey cacheKey, out object item) { T cachedItem; bool found = cacheEngine.Get(cacheKey, out cachedItem); item = cachedItem; return(found); }
public bool Get <T>(CacheKey cacheKey, out T cacheItem) { if (_memoryCacheEngine.Get(cacheKey, out cacheItem)) { return(true); } if (_redisCacheEngine.Get(cacheKey, out cacheItem)) { //if the item is in the redis cache but not the memory cache, add it to the memory level _memoryCacheEngine.Put(new CacheItemInfo { Item = cacheItem, Key = cacheKey }); return(true); } return(false); }