Пример #1
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 InMemoryObjectCache(ClearableMemoryCache cache, string cacheNamespace)
        {
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }

            _cache          = cache;
            _cacheNamespace = cacheNamespace ?? string.Empty;
        }
Пример #2
0
 /// <summary>
 /// Creates a new InMemoryObjectCacheFactory instance
 /// </summary>
 /// <param name="cacheName">
 /// The name of the MemoryCache configuration to use. If the cacheName is null the Default
 /// MemoryCache instance is used (recommended).
 /// </param>
 public InMemoryObjectCacheFactory(
     IOptions <MemoryCacheOptions> optionsAccessor
     )
 {
     _memoryCache = new ClearableMemoryCache(optionsAccessor);
 }