Example #1
0
        public void TestMethodAddSliding()
        {
            string key    = "TestMethodAddSliding";
            string value  = Guid.NewGuid().ToString();
            var    result = DistCache.AddForSliding(key, value, TimeSpan.FromSeconds(1), ProviderName);

            Assert.AreEqual(true, result);
            Thread.Sleep(500);
            var entity = DistCache.Get <string>(key, ProviderName);

            Assert.IsNotNull(entity);
            Assert.AreEqual(value, entity);
            Thread.Sleep(600);
            entity = DistCache.Get <string>(key, ProviderName);
            Assert.IsNotNull(entity);
            Assert.AreEqual(value, entity);
        }