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;
        }
Example #2
0
 public void Dispose()
 {
     _hybridCacher.FlushAll();
     _hybridCacher = null;
     _remoteCacher = null;
     _localCacher = null;
 }
 public void Dispose()
 {
     _hybridCacher.FlushAll();
     _hybridCacher = null;
     _remoteCacher = null;
     _localCacher  = null;
 }
        public HttpContextCacherTests()
        {
            // 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;

            _httpContextCacher = CacheManager.Settings.LocalCacher;
        }
        public HttpContextCacherTests()
        {
            // 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;

            _httpContextCacher = CacheManager.Settings.LocalCacher;
        }
        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()
 {
     _httpContextCacher.FlushAll();
     _httpContextCacher = null;
     HttpContext.Current = null;
 }
 public void Dispose()
 {
     _httpContextCacher.FlushAll();
     _httpContextCacher  = null;
     HttpContext.Current = null;
 }