Пример #1
0
 public DistributedCachableFactory(IDistributedCache cache,
                                   IEntrySerializer serializer, CachableOptions <DistributedCacheEntryOptions> options)
 {
     _cache      = cache;
     _serializer = serializer;
     _options    = options;
 }
Пример #2
0
        public static void AddDistributedCachable(this IServiceCollection services, Action <CachableOptions <DistributedCacheEntryOptions> > optionsConfigurator = null)
        {
            services.AddScoped <ICachableFactory, DistributedCachableFactory>();

            var options = new CachableOptions <DistributedCacheEntryOptions>();

            optionsConfigurator?.Invoke(options);
            services.AddSingleton(options);
        }
Пример #3
0
 public MemoryCachableFactory(IMemoryCache cache, CachableOptions <MemoryCacheEntryOptions> options)
 {
     _cache   = cache;
     _options = options;
 }