public void Test6() { ISoodaCache c = new SoodaInProcessCache(); c.Add("Contact", 1, DummyEntry(1), TimeSpan.FromHours(1), false); c.Add("Contact", 2, DummyEntry(2), TimeSpan.FromHours(1), false); c.Add("Contact", 3, DummyEntry(3), TimeSpan.FromHours(1), false); string ck = "Contact where 1=2"; c.StoreCollection(ck, "Contact", new int[] { 1, 2, 3 }, new string[] { "Contact", "Group", "Role" }, true, TimeSpan.FromHours(1), false); Assert.IsNotNull(c.LoadCollection(ck)); Assert.AreEqual(3, c.LoadCollection(ck).Count); c.Invalidate("Group", 3, SoodaCacheInvalidateReason.Updated); Assert.IsNull(c.LoadCollection(ck)); }
public void Test8() { SoodaInProcessCache c = new SoodaInProcessCache(); c.Add("Contact", 1, DummyEntry(1), TimeSpan.FromMilliseconds(150), false); c.Add("Contact", 2, DummyEntry(2), TimeSpan.FromMilliseconds(150), false); c.Add("Contact", 3, DummyEntry(3), TimeSpan.FromMilliseconds(150), false); string ck = "Contact where 1=2"; c.StoreCollection(ck, "Contact", new int[] { 1, 2, 3 }, new string[] { "Contact", "Group", "Role" }, true, TimeSpan.FromMilliseconds(150), false); Assert.IsNotNull(c.Find("Contact", 3)); System.Threading.Thread.Sleep(200); Console.WriteLine("*** Sweeping ***"); c.Sweep(); Console.WriteLine("*** Finished ***"); Assert.IsNull(c.Find("Contact", 3)); }
public void Test5() { ISoodaCache c = new SoodaInProcessCache(); string ck = "Contact where 1=2"; c.Add("Contact", 1, DummyEntry(1), TimeSpan.FromHours(1), false); c.Add("Contact", 2, DummyEntry(2), TimeSpan.FromHours(1), false); c.Add("Contact", 3, DummyEntry(3), TimeSpan.FromHours(1), false); c.StoreCollection(ck, "Contact", new int[] { 1, 2, 3 }, new string[0], true, TimeSpan.FromHours(1), false); Assert.IsNotNull(c.LoadCollection(ck)); Assert.AreEqual(3, c.LoadCollection(ck).Count); c.Evict("Contact", 3); Assert.IsNull(c.LoadCollection(ck)); }