public void T120_Rejuvenate() { using (var cache = PileCacheTestCore.MakeCache()) { var tA = cache.GetOrCreateTable <string>("A"); Assert.AreEqual(PutResult.Inserted, tA.Put("key1", "value1", 12)); Assert.AreEqual(PutResult.Inserted, tA.Put("key2", "value2", 12)); Assert.AreEqual(PutResult.Inserted, tA.Put("key3", "value3", 12)); Assert.AreEqual("value1", tA.Get("key1")); Assert.AreEqual("value2", tA.Get("key2")); Assert.AreEqual("value3", tA.Get("key3")); for (var i = 0; i < 30; i++) { Thread.Sleep(1000); Console.WriteLine("Second {0} Load Factor {1}", i, tA.LoadFactor); Assert.IsTrue(tA.Rejuvenate("key2")); } Assert.AreEqual(null, tA.Get("key1")); Assert.AreEqual("value2", tA.Get("key2"));//this is still here because it got rejuvenated Assert.AreEqual(null, tA.Get("key3")); Thread.Sleep(30000); Assert.AreEqual(null, tA.Get("key2"));//has died too Assert.AreEqual(0, tA.Count); } }
public void T070_DoesNotSeeAgedOrExpired() { using (var cache = PileCacheTestCore.MakeCache()) { var tA = cache.GetOrCreateTable <string>("A"); var tB = cache.GetOrCreateTable <string>("B"); var tC = cache.GetOrCreateTable <string>("C"); tC.Options.DefaultMaxAgeSec = 4; var tD = cache.GetOrCreateTable <string>("D"); Aver.IsTrue(PutResult.Inserted == tA.Put("key1", "value1")); //does not expire by itself Aver.IsTrue(PutResult.Inserted == tB.Put("key1", "value1", 7)); //will expire in 7 seconds Aver.IsTrue(PutResult.Inserted == tC.Put("key1", "value1")); //will expire in Options.DefaultMaxAgeSec Aver.IsTrue(PutResult.Inserted == tD.Put("key1", "value1", absoluteExpirationUTC: DateTime.UtcNow.AddSeconds(4))); //will expire at specific time Aver.AreObjectsEqual("value1", tA.Get("key1")); Aver.AreObjectsEqual("value1", tA.Get("key1", 3)); Aver.AreObjectsEqual("value1", tB.Get("key1")); Aver.AreObjectsEqual("value1", tC.Get("key1")); Aver.AreObjectsEqual("value1", tD.Get("key1")); Thread.Sleep(20000);// wait long enough to cover a few swep cycles (that may be 5+sec long) Aver.AreObjectsEqual("value1", tA.Get("key1")); Aver.AreObjectsEqual(null, tA.Get("key1", 3)); //did not expire, but aged over get limit Aver.AreObjectsEqual(null, tB.Get("key1")); //expired because of put with time limit Aver.AreObjectsEqual(null, tC.Get("key1")); //expired because of Options Aver.AreObjectsEqual(null, tD.Get("key1")); //expired because of absolute expiration on put } }
public void PutGetDelete_Parallel(int fromSize, int toSize, int fromObjCount, int toObjCount, int taskCount) { PileCacheTestCore.PutGetDelete_Parallel(fromSize, toSize, fromObjCount, toObjCount, taskCount); }
public void PutGetDelete_Sequential(int fromSize, int toSize, int fromObjCount, int toObjCount) { PileCacheTestCore.PutGetDelete_Sequential(fromSize, toSize, fromObjCount, toObjCount); }
public void VarSizes_Increasing_Random(bool isParallel, int cnt, int minSz, int maxSz, bool speed, bool rnd) { PileCacheTestCore.VarSizes_Increasing_Random(isParallel, cnt, minSz, maxSz, speed, rnd); }
public void VarSizes_Checkboard(bool isParallel, int cnt, int minSz, int maxSz, bool speed) { PileCacheTestCore.VarSizes_Checkboard(isParallel, cnt, minSz, maxSz, speed); }
public void T9000000_ParalellGetPutRemove(int workers, int tables, int putCount, int durationSec) { PileCacheTestCore.ParalellGetPutRemove(workers, tables, putCount, durationSec); }
public void T190_FID_PutGetCorrectness(int cnt, int tbls) { PileCacheTestCore.FID_PutGetCorrectness(cnt, tbls); }
public void T160_ResizeTable(int cnt, int rec, int payload) { PileCacheTestCore.ResizeTable(cnt, rec, payload); }
public void T150_KeyString_ManyPutGet(int cnt) { PileCacheTestCore.KeyString_ManyPutGet(cnt); }
public void T140_KeyGDID_ManyPutGet(int cnt) { PileCacheTestCore.KeyGDID_ManyPutGet(cnt); }
public void T130_KeyInt_ManyPutGet(int cnt) { PileCacheTestCore.KeyInt_ManyPutGet(cnt); }