Esempio n. 1
0
 public static void SetCache <T>(string cacheKey, T objObject)
 {
     using (var memoryDb = new MemoryDb())
     {
         if (memoryDb.Init(cacheKey, _size) == MemoryDbResult.Success)
         {
             var data = objObject.SerializeObject().ToByte();
             memoryDb.Write(data, 0, data.Length);
         }
     }
 }
Esempio n. 2
0
 public static string GetCache(string cacheKey)
 {
     using (var memoryDb = new MemoryDb())
     {
         if (memoryDb.Init(cacheKey, _size) == MemoryDbResult.Success)
         {
             var data = new byte[_size];
             memoryDb.Read(ref data, 0, data.Length);
             return(StringUitl.ByteToString(data));
         }
         return(null);
     }
 }