Exemplo n.º 1
0
 public List <KeyValuePair <string, T> > Load()
 {
     try
     {
         List <KeyValuePair <string, T> > list = new List <KeyValuePair <string, T> >();
         var dt = CacheDataDB.Get(_space);
         foreach (var row in dt)
         {
             T t = JsonSerialize.Instance.Deserialize <T>(row.NContent);
             KeyValuePair <string, T> o = new KeyValuePair <string, T>(row.NKey, t);
             list.Add(o);
         }
         return(list);
     }
     catch (Exception ex)
     {
         LogHelper.LogError("RedisPersistentStores", "PersistentStores.Load", ex.ToString());
     }
     return(new List <KeyValuePair <string, T> >());
 }
Exemplo n.º 2
0
        public void Test()
        {
            var b = CacheDataDB.Add("space", "key", "content");

            Assert.IsTrue(b);

            var dl = CacheDataDB.Get("space");

            Assert.IsNotNull(dl);

            var d = dl.FirstOrDefault();


            b  = CacheDataDB.Update("space", "key", "content2");
            dl = CacheDataDB.Get("space");
            Assert.IsNotNull(dl);

            var d1 = dl.FirstOrDefault();

            b = (d1.NContent == "content2");
            Assert.IsTrue(b);
        }