public void TestExpiryPolicy()
        {
            var cache = new CacheEx();

            Assert.IsNull(cache.ExpiryPolicy);

            var holder = new ExpiryCacheHolder <int, int>(cache);

            // Check same cache for same expiry.
            var cache1 = (CacheEx)holder.GetCacheWithExpiry(15);

            CheckExpiry(TimeSpan.FromSeconds(15), cache1);
            Assert.AreNotSame(cache, cache1);
            Assert.AreSame(cache1, holder.GetCacheWithExpiry(15));

            // Check rounding.
            var cache2 = (CacheEx)holder.GetCacheWithExpiry(DateTime.UtcNow.AddSeconds(15.1));

            Assert.AreSame(cache1, cache2);

            // Check no expiration.
            var cache3 = (CacheEx)holder.GetCacheWithExpiry(DateTime.MaxValue);

            Assert.AreSame(cache, cache3);
        }
Beispiel #2
0
        public override void Initialize(string name, NameValueCollection config)
        {
            base.Initialize(name, config);

            var cache = ConfigUtil.InitializeCache <string, object>(config, GetType(), null);

            _expiryCacheHolder = new ExpiryCacheHolder <string, object>(cache);
        }
Beispiel #3
0
        public override void Initialize(string name, NameValueCollection config)
        {
            base.Initialize(name, config);

            var cache = ConfigUtil.InitializeCache <string, IgniteSessionStateStoreData>(config, GetType());

            _expiryCacheHolder = new ExpiryCacheHolder <string, IgniteSessionStateStoreData>(cache);

            _applicationId = config[ApplicationId];
        }
        public override void Initialize(string name, NameValueCollection config)
        {
            base.Initialize(name, config);

            var cache = ConfigUtil.InitializeCache<string, object>(config, GetType(), null);

            _expiryCacheHolder = new ExpiryCacheHolder<string, object>(cache);
        }