public void Add_Datetime_TTLAbsSli() { DateTime dt_1 = DateTime.Now; ItemCache <DateTime> ic_1 = new ItemCache <DateTime>(); ic_1.Key = "Add_Datetime_TTLAbsSli"; ic_1.Value = dt_1; ic_1.SlidingExpiration = new TimeSpan(0, 0, 10); ic_1.AbsoluteExpiration = new TimeSpan(0, 0, 25); ic_1.Save(true); System.Threading.Thread.Sleep(5000); ItemCache <DateTime> ic_2 = ItemCache <DateTime> .GetItem("Add_Datetime_TTLAbsSli"); Assert.AreEqual <DateTime>(dt_1, ic_2.Value); System.Threading.Thread.Sleep(5000); ItemCache <DateTime> ic_3 = ItemCache <DateTime> .GetItem("Add_Datetime_TTLAbsSli"); Assert.AreEqual <DateTime>(dt_1, ic_3.Value); System.Threading.Thread.Sleep(10000); ItemCache <DateTime> ic_4 = ItemCache <DateTime> .GetItem("Add_Datetime_TTLAbsSli"); Assert.AreEqual(ic_4, null); }
public void SetToPy() { string test = Properties.Settings.Default.Value_Text; Redis.Cache.ItemCache <string> t = new ItemCache <string>("k1", test); t.Save(false); }
public void Add_String() { string obj_1 = Properties.Settings.Default.Value_Text_long; ItemCache<string> ic_1 = new ItemCache<string>(); ic_1.Key = "Add_String"; ic_1.Value = obj_1; ic_1.Save(true); ItemCache<string> ic_2 = ItemCache<string>.GetItem("Add_String"); Assert.AreEqual<string>(obj_1, ic_2.Value); }
public void Add_Datetime() { DateTime dt_1 = DateTime.Now; ItemCache<DateTime> ic_1 = new ItemCache<DateTime>(); ic_1.Key = "Add_Datetime"; ic_1.Value = dt_1; ic_1.Save(true); ItemCache<DateTime> ic_2 = ItemCache<DateTime>.GetItem("Add_Datetime"); Assert.AreEqual<DateTime>(dt_1, ic_2.Value); }
public void Add_String() { string obj_1 = Properties.Settings.Default.Value_Text_long; ItemCache <string> ic_1 = new ItemCache <string>(); ic_1.Key = "Add_String"; ic_1.Value = obj_1; ic_1.Save(true); ItemCache <string> ic_2 = ItemCache <string> .GetItem("Add_String"); Assert.AreEqual <string>(obj_1, ic_2.Value); }
public void Add_Datetime() { DateTime dt_1 = DateTime.Now; ItemCache <DateTime> ic_1 = new ItemCache <DateTime>(); ic_1.Key = "Add_Datetime"; ic_1.Value = dt_1; ic_1.Save(true); ItemCache <DateTime> ic_2 = ItemCache <DateTime> .GetItem("Add_Datetime"); Assert.AreEqual <DateTime>(dt_1, ic_2.Value); }
static void Main(string[] args) { DateTime dt = DateTime.Now; Redis.Cache.ItemCache<DateTime> ic = new ItemCache<DateTime>("dt_1", dt); ic.Save(true); ItemCache<DateTime> dt_result = Redis.Cache.ItemCache<DateTime>.GetItem("dt_1"); System.Console.WriteLine((dt == dt_result.Value).ToString()); System.Console.WriteLine(DateTime.Now.ToUniversalTime()); System.Console.WriteLine(DateTime.UtcNow); }
public void Add_Datetime_TTLAbsSli_Exist() { DateTime dt_1 = DateTime.Now; ItemCache <DateTime> ic_1 = new ItemCache <DateTime>(); ic_1.Key = "Add_Datetime_TTLAbsSli_Exist"; ic_1.Value = dt_1; ic_1.SlidingExpiration = new TimeSpan(0, 0, 10); ic_1.AbsoluteExpiration = new TimeSpan(0, 0, 25); ic_1.Save(true); System.Threading.Thread.Sleep(5000); Assert.AreEqual(true, ItemCache <DateTime> .ExistItem("Add_Datetime_TTLAbsSli_Exist")); }
static void Main(string[] args) { DateTime dt = DateTime.Now; Redis.Cache.ItemCache <DateTime> ic = new ItemCache <DateTime>("dt_1", dt); ic.Save(true); ItemCache <DateTime> dt_result = Redis.Cache.ItemCache <DateTime> .GetItem("dt_1"); System.Console.WriteLine((dt == dt_result.Value).ToString()); System.Console.WriteLine(DateTime.Now.ToUniversalTime()); System.Console.WriteLine(DateTime.UtcNow); }
public void Add_Datetime_TTLAbs() { DateTime dt_1 = DateTime.Now; ItemCache<DateTime> ic_1 = new ItemCache<DateTime>(); ic_1.Key = "Add_Datetime_TTLAbs"; ic_1.Value = dt_1; ic_1.AbsoluteExpiration = new TimeSpan(0, 0, 20); ic_1.Save(true); System.Threading.Thread.Sleep(5000); ItemCache<DateTime> ic_2 = ItemCache<DateTime>.GetItem("Add_Datetime_TTLAbs"); Assert.AreEqual<DateTime>(dt_1, ic_2.Value); System.Threading.Thread.Sleep(20000); ItemCache<DateTime> ic_3 = ItemCache<DateTime>.GetItem("Add_Datetime_TTLAbs"); Assert.AreEqual(ic_3, null); }
public void Add_Datetime_TTLAbsSli_Exist() { DateTime dt_1 = DateTime.Now; ItemCache<DateTime> ic_1 = new ItemCache<DateTime>(); ic_1.Key = "Add_Datetime_TTLAbsSli_Exist"; ic_1.Value = dt_1; ic_1.SlidingExpiration = new TimeSpan(0, 0, 10); ic_1.AbsoluteExpiration = new TimeSpan(0, 0, 25); ic_1.Save(true); System.Threading.Thread.Sleep(5000); Assert.AreEqual(true, ItemCache<DateTime>.ExistItem("Add_Datetime_TTLAbsSli_Exist")); }
public void SetToPy() { string test = Properties.Settings.Default.Value_Text; Redis.Cache.ItemCache<string> t = new ItemCache<string>("k1", test); t.Save(false); }