public TwoLevelCacheProvider(IOptions <MemoryCacheOptions> options, RedisProvider redisProvider, IMemoryCache memoryCache, IOptions <CacheManagerOptions> cacheManagerOptions) { var cacheOptions = cacheManagerOptions.Value.CacheOptions; foreach (var(cacheName, _) in cacheOptions) { var redisCache = redisProvider.GetCache(cacheName); options.Value.CacheOptions.TryGetValue(cacheName, out var memoryCacheOptions); var cacheWrapper = new TwoLevelCache( redisCache, memoryCache, cacheName, memoryCacheOptions?.EntityCacheOptions ?? options.Value.DefaultOptions, memoryCacheOptions?.SetsCacheOptions ?? options.Value.DefaultOptions); _caches.Add(cacheName, cacheWrapper); } }