public void UpdateCache() { var cache = new ShareCacheStruct <ChildData>(); var data = cache.FindKey(1); if (data == null) { data = new ChildData() { ChildId = 1, Age = 20 }; Assert.IsTrue(cache.Add(data), "add cache faild."); } int age = data.Age; age++; data.Age = age; cache.Add(data); Assert.IsFalse(data.HasChanged); cache.UnLoad(); data = cache.FindKey(1); Assert.IsTrue(data != null && data.Age == age, "update data fail."); }