public void Set(string key, T content) { try { string s = ""; if (content is string) { s = content.ToString(); } else { s = JsonSerialize.Instance.Serialize <T>(content); } CacheDataDB.Update(_space, key.ToString(), s); } catch (Exception ex) { LogHelper.LogError("RedisPersistentStores", "PersistentStores.Set", ex.ToString()); } }
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); }