예제 #1
0
        public RedisCacheManager(
            ICacheManager perRequestCacheManager,
            IRedisConnectionWrapper connectionWrapper,
            CacheOptions config)
        {
            if (string.IsNullOrEmpty(config.RedisCachingConnection))
            {
                throw new Exception("Redis connection string is empty");
            }

            _perRequestCacheManager = perRequestCacheManager;

            // ConnectionMultiplexer.Connect should only be called once and shared between callers
            _connectionWrapper = connectionWrapper;

            _db     = _connectionWrapper.GetDatabase();
            _config = config;
        }
예제 #2
0
 public RedisConnectionWrapper(CacheOptions config)
 {
     _config           = config;
     _connectionString = new Lazy <string>(GetConnectionString);
     _redisLockFactory = CreateRedisLockFactory();
 }
예제 #3
0
 public MemoryCacheManager(IMemoryCache cache, CacheOptions config)
 {
     _cache  = cache;
     _config = config;
     _cancellationTokenSource = new CancellationTokenSource();
 }
예제 #4
0
 public PerRequestCacheManager(IHttpContextAccessor httpContextAccessor, CacheOptions config)
 {
     _httpContextAccessor = httpContextAccessor;
     _config = config;
 }