protected BaseCache( IDistributedCache distributedCache, string key, DistributedCacheEntryOptions cacheEntryOptions, Func <TStore, TCache> cacheSelector, IMemoryCache memoryCache, CacheInMemoryOffload cacheInMemoryOffload, TimeSpan inMemoryValidTo) { this.distributedCache = distributedCache; this.key = key; this.cacheEntryOptions = cacheEntryOptions; this.cacheSelector = cacheSelector; this.memoryCache = memoryCache; this.cacheInMemoryOffload = cacheInMemoryOffload; this.inMemoryValidTo = inMemoryValidTo; if (cacheInMemoryOffload == CacheInMemoryOffload.Scoped) { memoryCache.Remove(key); } }
protected BaseStateCache( IDistributedCache distributedCache, Func <TState, string> keySelector, DistributedCacheEntryOptions cacheEntryOptions, Func <TStore, TCache> cacheSelector, IMemoryCache memoryCache, CacheInMemoryOffload cacheInMemoryOffload, TimeSpan inMemoryValidTo) { this.distributedCache = distributedCache; this.keySelector = keySelector; this.cacheEntryOptions = cacheEntryOptions; this.cacheSelector = cacheSelector; this.memoryCache = memoryCache; this.cacheInMemoryOffload = cacheInMemoryOffload; this.inMemoryValidTo = inMemoryValidTo; this.cacheInMemoryOffload = cacheInMemoryOffload; this.inMemoryValidTo = inMemoryValidTo; if (cacheInMemoryOffload == CacheInMemoryOffload.Scoped) { inMemoryValidTo = TimeSpan.FromSeconds(2); } }