public HttpRuntimeCacheWrapper(string cacheKey, CacheWrapper cache) { lock (CacheLock) { _cacheDict = cache.Get <Dictionary <string, TValue> >(cacheKey); if (_cacheDict == null) { _cacheDict = new Dictionary <string, TValue>(); cache.Add(cacheKey, _cacheDict); } } }
public IList <Item> GetAll() { IList <Item> retVal; if (CacheWrapper.Exists(cacheKey)) { CacheWrapper.Get(cacheKey, out retVal); } else { retVal = _items; CacheWrapper.Add(retVal, cacheKey, DateTimeOffset.UtcNow.AddMinutes(1)); } return(retVal); }
private LanguageCache GetLanguageCache() { var cache = cacheWrapper.Get <LanguageCache>("CachingLanguageGatewayDecorator_" + masterKey); if (cache == null) { cache = new LanguageCache { LanguageCodes = new Dictionary <string, ILanguage>(), LanguageItems = new Dictionary <int, ILanguage>() }; cacheWrapper.Add("CachingLanguageGatewayDecorator_" + masterKey, cache, new CacheOptions { SlidingExpiration = slidingExpiration }); } return(cache); }