Ejemplo n.º 1
0
 public void Can_set_and_reset_item_in_cache_with_expiration() {
     var cache = new DreamCache(TaskTimerFactory.Current);
     cache.Set("foo", "bar", DateTime.UtcNow.AddSeconds(10));
     cache.Set("foo", "baz", DateTime.UtcNow.AddSeconds(15));
     var cached = cache.Get("foo", string.Empty);
     Assert.AreEqual("baz", cached);
 }
Ejemplo n.º 2
0
 public void Can_set_and_reset_item_in_cache_with_sliding_expiration() {
     var cache = new DreamCache(TaskTimerFactory.Current);
     cache.Set("foo", "bar", 10.Seconds());
     cache.Set("foo", "baz", 15.Seconds());
     var cached = cache.Get("foo", string.Empty);
     Assert.AreEqual("baz", cached);
 }
Ejemplo n.º 3
0
 public void Can_set_and_reset_item_in_cache() {
     var cache = new DreamCache(TaskTimerFactory.Current);
     cache.Set("foo", "bar");
     cache.Set("foo", "baz");
     var cached = cache.Get("foo", string.Empty);
     Assert.AreEqual("baz", cached);
 }
Ejemplo n.º 4
0
        public void Can_set_and_reset_item_in_cache_with_expiration()
        {
            var cache = new DreamCache(TaskTimerFactory.Current);

            cache.Set("foo", "bar", DateTime.UtcNow.AddSeconds(10));
            cache.Set("foo", "baz", DateTime.UtcNow.AddSeconds(15));
            var cached = cache.Get("foo", string.Empty);

            Assert.AreEqual("baz", cached);
        }
Ejemplo n.º 5
0
        public void Can_set_and_reset_item_in_cache_with_sliding_expiration()
        {
            var cache = new DreamCache(TaskTimerFactory.Current);

            cache.Set("foo", "bar", 10.Seconds());
            cache.Set("foo", "baz", 15.Seconds());
            var cached = cache.Get("foo", string.Empty);

            Assert.AreEqual("baz", cached);
        }
Ejemplo n.º 6
0
        public void Can_set_and_reset_item_in_cache()
        {
            var cache = new DreamCache(TaskTimerFactory.Current);

            cache.Set("foo", "bar");
            cache.Set("foo", "baz");
            var cached = cache.Get("foo", string.Empty);

            Assert.AreEqual("baz", cached);
        }