コード例 #1
0
 public void TestSetStringTwice()
 {
     using (var externalCache = new ExternalCache())
     {
         externalCache.Set("Item 1", "Value 1", new TimeSpan(10000000)); // 10000 ticks = 1ms
         var item = (string)externalCache.Get("Item 1");
         Assert.AreEqual("Value 1", item);
         externalCache.Set("Item 1", "Value 2", new TimeSpan(10000000)); // 10000 ticks = 1ms
         item = (string)externalCache.Get("Item 1");
         Assert.AreEqual("Value 2", item);
     }
 }
コード例 #2
0
 public void TestSetStringAndLetItExpireByAbsoluteTime()
 {
     using (var externalCache = new ExternalCache())
     {
         externalCache.Set("Item 1", "Value 1", new DateTimeOffset(DateTime.Now.AddMilliseconds(1000)));
         CheckItem1AsString(externalCache);
     }
 }
コード例 #3
0
 public void TestSetStringAndLetItExpireByTicks()
 {
     using (var externalCache = new ExternalCache())
     {
         externalCache.Set("Item 1", "Value 1", new TimeSpan(10000000)); // 10000 ticks = 1ms
         CheckItem1AsString(externalCache);
     }
 }
コード例 #4
0
        public void TestSetObjectAndLetItExpireByAbsoluteTime()
        {
            using (var externalCache = new ExternalCache())
            {
                var item = new Dynamo();
                item["P1"] = "Property 1";
                externalCache.Set("Item 1", item, DateTime.Now.AddMilliseconds(1000));

                CheckItem1(externalCache);
            }
        }
コード例 #5
0
        public void TestSetObjectAndLetItExpireByTicks()
        {
            using (var externalCache = new ExternalCache())
            {
                var item = new Dynamo();
                item["P1"] = "Property 1";
                externalCache.Set("Item 1", item, new TimeSpan(10000000)); // 10000 ticks = 1ms

                CheckItem1(externalCache);
            }
        }