Example #1
0
 public void GetCacheItem()
 {
     Model.User user = new Model.User { Name = "henry" + Guid.NewGuid().ToString("N"), EMail = "*****@*****.**" };
     cache.Set(user.Name, user);
     cache.Get(user.Name, typeof(Model.User));
     ICacheItem item = cache.GetCacheItem(user.Name);
     Console.WriteLine(item.LevelCached);
 }
Example #2
0
        public void Get()
        {

            Model.User user = new Model.User { Name = "henry", EMail = "*****@*****.**" };
            cache.Set("henry", user);
            Model.User result = cache.Get<Model.User>("henry");
            Assert.AreEqual(user.EMail, result.EMail);

        }
Example #3
0
        public void Upgrade()
        {

            Model.User user = new Model.User { Name = "henry", EMail = "*****@*****.**" };
            cache.Set("henry", user);
            Model.User result = cache.Get<Model.User>("henry");
            ICacheItem item = cache.GetCacheItem(user.Name);
            Assert.AreEqual(item.LevelCached, "l3");
            for (int i = 0; i < 11; i++)
            {
                item = cache.GetCacheItem(user.Name);
            }
            Assert.AreEqual(item.LevelCached, "l2");
            for (int i = 0; i < 11; i++)
            {
                item = cache.GetCacheItem(user.Name);
            }
            Assert.AreEqual(item.LevelCached, "l1");
           
        }
Example #4
0
        public void Upgrade()
        {
            Model.User user = new Model.User {
                Name = "henry", EMail = "*****@*****.**"
            };
            cache.Set("henry", user);
            Model.User result = cache.Get <Model.User>("henry");
            ICacheItem item   = cache.GetCacheItem(user.Name);

            Assert.AreEqual(item.LevelCached, "l3");
            for (int i = 0; i < 11; i++)
            {
                item = cache.GetCacheItem(user.Name);
            }
            Assert.AreEqual(item.LevelCached, "l2");
            for (int i = 0; i < 11; i++)
            {
                item = cache.GetCacheItem(user.Name);
            }
            Assert.AreEqual(item.LevelCached, "l1");
        }
Example #5
0
 public void WriteTest()
 {
     Model.User user = new Model.User { Name = "henry" + Guid.NewGuid().ToString("N"), EMail = "*****@*****.**" };
     cache.Set(user.Name, user);
 }