public void MyTestMethod() { var key = "key"; var cachekey = key.BuildFullKey <datacls>(); var fromcache = new datacls { DateTime = System.DateTime.Now }; this._cacheState.PutObjectByKey(cachekey, fromcache); var cachefrom = this._cacheState.Get <datacls>(key); Assert.AreEqual(fromcache.DateTime, cachefrom.DateTime); }
public void MyTestMethod() { var key = "key"; var cachekey = key.BuildFullKey<datacls>(); var fromcache = new datacls { DateTime = System.DateTime.Now }; this._cacheState.PutObjectByKey(cachekey, fromcache); var cachefrom = this._cacheState.Get<datacls>(key); Assert.AreEqual(fromcache.DateTime, cachefrom.DateTime); }
public void MyTestMethod_GetType_111() { var mykey = "adfasdf"; var val = new datacls { DateTime = System.DateTime.Now }; this._cacheState.PutObjectByKey(mykey, val, System.DateTime.Now.AddSeconds(1)); var cacheval = this._cacheState.GetObjectByKey(mykey); Assert.IsNotNull(cacheval); Thread.Sleep(1 * 1000); cacheval = this._cacheState.GetObjectByKey(mykey); Assert.IsNull(cacheval); }
public void MyTestMethod_GetType_abs() { var mykey = "adfasdf"; var val = new datacls { DateTime = System.DateTime.Now }; this._cacheState.PutObjectByKey(mykey, val, new System.TimeSpan(0, 0, 1)); var cacheval = this._cacheState.GetObjectByKey(mykey); Assert.IsNotNull(cacheval); Thread.Sleep(1 * 500); Thread.Sleep(1 * 500); cacheval = this._cacheState.GetObjectByKey(mykey); Assert.IsNull(cacheval); }