コード例 #1
0
 public SqlDistributedObjectCacheFactory(
     IOptions <SqlServerCacheOptions> optionsAccessor,
     IDistributedCache cache
     )
 {
     _cache    = cache;
     _sqlCache = new ClearableSqlDistributedCache(_cache);
 }
コード例 #2
0
        /// <summary>
        /// Creates a new instance of an InMemoryObjectCache object.
        /// </summary>
        /// <param name="cache">The parent MemoryCache instance to use.</param>
        /// <param name="cacheNamespace">Unique cache namespace to organise all cache items under.</param>
        public SqlDistributedObjectCache(ClearableSqlDistributedCache cache, string cacheNamespace)
        {
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }

            _cache          = cache;
            _cacheNamespace = cacheNamespace ?? string.Empty;
        }