예제 #1
0
        public void Add_Datetime_TTLAbsSli_Delete()
        {
            DateTime             dt_1 = DateTime.Now;
            ItemCache <DateTime> ic_1 = new ItemCache <DateTime>();

            ic_1.Key                = "Add_Datetime_TTLAbsSli_Delete";
            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(8000);
            ItemCache <DateTime> ic_2 = ItemCache <DateTime> .GetItem("Add_Datetime_TTLAbsSli_Delete");

            Assert.AreEqual <DateTime>(dt_1, ic_2.Value);

            ItemCache <DateTime> .DeleteItem("Add_Datetime_TTLAbsSli_Delete");

            ItemCache <DateTime> ic_3 = ItemCache <DateTime> .GetItem("Add_Datetime_TTLAbsSli_Delete");

            Assert.AreEqual(ic_3, null);
        }
예제 #2
0
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     ItemCache.DeleteItem(CurrentItem);
     this.DialogResult = true;
 }