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

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

            Assert.IsNotNull(entity);
            Assert.AreEqual(value, entity);
            Thread.Sleep(600);
            entity = DistCache.Get <string>(key);
            Assert.IsNotNull(entity);
            Assert.AreEqual(value, entity);
        }
Example #2
0
 public void Init()
 {
     DistCache.RemoveAll();
     DistCache.ChangeProvider("MemcachedCacheProvider");
 }