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); }
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); }
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); }
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); }
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"); }
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"); }
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"); }