Exemplo n.º 1
0
        private ICacheDependencyManager GetRedisCacheDependencyManagerIfApplicable(CacheConfig config, ICache cache)
        {
            ICacheDependencyManager dependencyMgr = null;
            var redisCache = cache as RedisCacheAdapter;

            if (redisCache != null)
            {
                dependencyMgr = new RedisDependencyManager(cache, _logger, redisCache.RedisDatabase, config);
            }
            else
            {
                dependencyMgr = new GenericDependencyManager(cache, _logger, config);
            }
            return(dependencyMgr);
        }
Exemplo n.º 2
0
        public override CacheFactoryComponentResult CreateCacheComponents()
        {
            var cacheEngine = CreateCacheEngine();

            ICacheDependencyManager dependencyMgr = null;

            if (CacheConfiguration.DependencyManagerToUse == CacheDependencyManagerTypes.Generic)
            {
                dependencyMgr = new GenericDependencyManager(cacheEngine, Logger, CacheConfiguration);
            }
            else
            {
                dependencyMgr = new RedisDependencyManager(cacheEngine, Logger, _redisConnection.GetDatabase(), CacheConfiguration);
            }
            var featureSupport = new RedisFeatureSupport();
            var result         = CacheFactoryComponentResult.Create(cacheEngine, dependencyMgr, featureSupport);

            return(result);
        }