Пример #1
0
        public HybridCacherTests()
        {
            // have to fake an http context to use http context cache
            HttpContext.Current = new HttpContext(new HttpRequest(null, "http://tempuri.org", null), new HttpResponse(null));

            CacheManager.Init(TestSettings.RedisHost, TestSettings.RedisPort, TestSettings.RedisPassword, TestSettings.RedisDb, TestSettings.KeyPrefix);
            _cacheSleeve = CacheManager.Settings;

            var cacheSleeve = CacheManager.Settings;

            var configuration =
                ConfigurationOptions.Parse(string.Format("{0}:{1}", TestSettings.RedisHost, TestSettings.RedisPort));

            configuration.AllowAdmin = true;
            var redisConnection = ConnectionMultiplexer.Connect(configuration);

            var subscriber = redisConnection.GetSubscriber();

            subscriber.Subscribe("cacheSleeve.remove.*", (redisChannel, value) => OnSubscriptionHit(redisChannel, GetString(value)));
            subscriber.Subscribe("cacheSleeve.flush*", (redisChannel, value) => OnSubscriptionHit(redisChannel, "flush"));

            _hybridCacher = new HybridCacher();
            _remoteCacher = cacheSleeve.RemoteCacher;
            _localCacher  = cacheSleeve.LocalCacher;
        }
Пример #2
0
 public void Dispose()
 {
     _hybridCacher.FlushAll();
     _hybridCacher = null;
     _remoteCacher = null;
     _localCacher = null;
 }
Пример #3
0
 public void Dispose()
 {
     _hybridCacher.FlushAll();
     _hybridCacher = null;
     _remoteCacher = null;
     _localCacher  = null;
 }
        public RedisCacherAsyncTests()
        {
            // have to fake an http context to use http context cache
            HttpContext.Current = new HttpContext(new HttpRequest(null, "http://tempuri.org", null), new HttpResponse(null));

            CacheManager.Init(TestSettings.RedisHost, TestSettings.RedisPort, TestSettings.RedisPassword, TestSettings.RedisDb, TestSettings.KeyPrefix);
            _cacheSleeve = CacheManager.Settings;

            _redisCacher = CacheManager.Settings.RemoteCacher;
        }
        public RedisCacherAsyncTests()
        {
            // have to fake an http context to use http context cache
            HttpContext.Current = new HttpContext(new HttpRequest(null, "http://tempuri.org", null), new HttpResponse(null));

            CacheManager.Init(TestSettings.RedisHost, TestSettings.RedisPort, TestSettings.RedisPassword, TestSettings.RedisDb, TestSettings.KeyPrefix);
            _cacheSleeve = CacheManager.Settings;

            _redisCacher = CacheManager.Settings.RemoteCacher;
        }
Пример #6
0
 /// <inheritdoc />
 public InternalCacheSet([NotNull] ISetCollection context)
 {
     _context        = context;
     _dictionary     = new ConcurrentDictionary <string, T>();
     _list           = new HashSet <T>();
     _constructor    = typeof(T).GetConstructor(new Type[] { });
     _mergeLock      = new object();
     _cacheMap       = RedisCacher.GetCacheMap <T>();
     _cachingService = new CachingPersistеnceService(_context);
 }
Пример #7
0
        public CacheManagerTests()
        {
            // have to fake an http context to use http context cache
            HttpContext.Current = new HttpContext(new HttpRequest(null, "http://tempuri.org", null), new HttpResponse(null));

            CacheManager.Init(TestSettings.RedisHost, TestSettings.RedisPort, TestSettings.RedisPassword, TestSettings.RedisDb, TestSettings.KeyPrefix);
            _cacheSleeve = CacheManager.Settings;

            var configuration =
                ConfigurationOptions.Parse(string.Format("{0}:{1}", TestSettings.RedisHost, TestSettings.RedisPort));
            configuration.AllowAdmin = true;
            var redisConnection = ConnectionMultiplexer.Connect(configuration);

            var subscriber = redisConnection.GetSubscriber();
            subscriber.Subscribe("cacheSleeve.remove.*", (redisChannel, value) => OnSubscriptionHit(redisChannel, GetString(value)));
            subscriber.Subscribe("cacheSleeve.flush*", (redisChannel, value) => OnSubscriptionHit(redisChannel, "flush"));

            _hybridCacher = new HybridCacher();
            _remoteCacher = _cacheSleeve.RemoteCacher;
            _localCacher = _cacheSleeve.LocalCacher;
        }
 public void Dispose()
 {
     _redisCacher.FlushAll();
     _redisCacher = null;
 }
 public void Dispose()
 {
     _redisCacher.FlushAll();
     _redisCacher = null;
 }
Пример #10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cacher"></param>
 /// <param name="serviceProvider"></param>
 public Donutfile(RedisCacher cacher, IServiceProvider serviceProvider)
 {
     //_integrationService = serviceProvider.GetService(typeof(IntegrationService)) as IntegrationService;
 }