private IResourceCache GetInnerCache() { var httpContext = _getHttpContext(); if (httpContext == null) { return(NullResourceCache.Instance); } var innerCache = httpContext.Cache.Get(CacheKey) as IResourceCache; if (innerCache == null) { lock (_resourceCacheMutex) { innerCache = httpContext.Cache.Get(CacheKey) as IResourceCache; if (innerCache == null) { innerCache = new InMemoryThreadSafeResourceCache(); httpContext.Cache.Insert(CacheKey, innerCache, null, DateTime.Now.AddSeconds(15), Cache.NoSlidingExpiration); } } } return(innerCache); }
private IResourceCache GetInnerCache() { var httpContext = _getHttpContext(); if (httpContext == null) return NullResourceCache.Instance; var innerCache = httpContext.Cache.Get(CacheKey) as IResourceCache; if(innerCache == null) { lock(_resourceCacheMutex) { innerCache = httpContext.Cache.Get(CacheKey) as IResourceCache; if (innerCache == null) { innerCache = new InMemoryThreadSafeResourceCache(); httpContext.Cache.Insert(CacheKey, innerCache, null, DateTime.Now.AddSeconds(15), Cache.NoSlidingExpiration); } } } return innerCache; }