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); } } }
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); } }