Esempio n. 1
0
 public void Build()
 {
     cache = new Cache();
     cacheItemUUID = UUID.Random();
     MemoryCacheItem cachedItem = new MemoryCacheItem(cacheItemUUID.ToString(),DateTime.Now + TimeSpan.FromDays(1));
     byte[] foo = new byte[1];
     foo[0] = 255;
     cachedItem.Store(foo);
     cache.Store(cacheItemUUID.ToString(), cachedItem);
 }
Esempio n. 2
0
 public void Build()
 {
     cache = new Cache();
     cache = new Cache(CacheMedium.Memory,CacheStrategy.Aggressive,CacheFlags.AllowUpdate);
     cacheItemUUID = UUID.Random();
     MemoryCacheItem cachedItem = new MemoryCacheItem(cacheItemUUID.ToString(),DateTime.Now + TimeSpan.FromDays(1));
     byte[] foo = new byte[1];
     foo[0] = 255;
     cachedItem.Store(foo);
     cache.Store(cacheItemUUID.ToString(), cachedItem);
 }
Esempio n. 3
0
        public void Build()
        {
            cache         = new Cache();
            cacheItemUUID = UUID.Random();
            MemoryCacheItem cachedItem = new MemoryCacheItem(cacheItemUUID.ToString(), DateTime.Now + TimeSpan.FromDays(1));

            byte[] foo = new byte[1];
            foo[0] = 255;
            cachedItem.Store(foo);
            cache.Store(cacheItemUUID.ToString(), cachedItem);
        }
Esempio n. 4
0
        public void Build()
        {
            cache         = new Cache();
            cache         = new Cache(CacheMedium.Memory, CacheStrategy.Aggressive, CacheFlags.AllowUpdate);
            cacheItemUUID = UUID.Random();
            MemoryCacheItem cachedItem = new MemoryCacheItem(cacheItemUUID.ToString(), DateTime.Now + TimeSpan.FromDays(1));

            byte[] foo = new byte[1];
            foo[0] = 255;
            cachedItem.Store(foo);
            cache.Store(cacheItemUUID.ToString(), cachedItem);
        }
Esempio n. 5
0
 public void ExpireItemManually()
 {
     UUID ImmediateExpiryUUID = UUID.Random();
     MemoryCacheItem cachedItem = new MemoryCacheItem(ImmediateExpiryUUID.ToString(), TimeSpan.FromDays(1));
     byte[] foo = new byte[1];
     foo[0] = 1;
     cachedItem.Store(foo);
     cache.Store(cacheItemUUID.ToString(), cachedItem);
     cache.Invalidate(cacheItemUUID.ToString());
     cache.Get(cacheItemUUID.ToString());
     object citem = cache.Get(cacheItemUUID.ToString());
     Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it");
 }
Esempio n. 6
0
        public void TestTTLExpiredEntry()
        {
            UUID ImmediateExpiryUUID = UUID.Random();
            MemoryCacheItem cachedItem = new MemoryCacheItem(ImmediateExpiryUUID.ToString(), TimeSpan.FromDays(-1));
            byte[] foo = new byte[1];
            foo[0] = 1;
            cachedItem.Store(foo);
            cache.Store(cacheItemUUID.ToString(), cachedItem);

            cache.Get(cacheItemUUID.ToString());
            //object citem = cache.Get(cacheItemUUID.ToString());
            //Assert.That(citem == null, "Item should not be in Cache because the expiry time was before now");
        }
Esempio n. 7
0
        public void ExpireItemManually()
        {
            UUID            ImmediateExpiryUUID = UUID.Random();
            MemoryCacheItem cachedItem          = new MemoryCacheItem(ImmediateExpiryUUID.ToString(), TimeSpan.FromDays(1));

            byte[] foo = new byte[1];
            foo[0] = 1;
            cachedItem.Store(foo);
            cache.Store(cacheItemUUID.ToString(), cachedItem);
            cache.Invalidate(ImmediateExpiryUUID.ToString());
            cache.Get(cacheItemUUID.ToString());
            //object citem = cache.Get(cacheItemUUID.ToString());
            //Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it");
        }
Esempio n. 8
0
        public void TestTTLExpiredEntry()
        {
            UUID            ImmediateExpiryUUID = UUID.Random();
            MemoryCacheItem cachedItem          = new MemoryCacheItem(ImmediateExpiryUUID.ToString(), TimeSpan.FromDays(-1));

            byte[] foo = new byte[1];
            foo[0] = 1;
            cachedItem.Store(foo);
            cache.Store(cacheItemUUID.ToString(), cachedItem);

            cache.Get(cacheItemUUID.ToString());
            //object citem = cache.Get(cacheItemUUID.ToString());
            //Assert.That(citem == null, "Item should not be in Cache because the expiry time was before now");
        }