示例#1
0
        public async Task Should_not_invalidate_other_instances_when_added()
        {
            var cache1 = new ReplicatedCache(CreateMemoryCache(), pubSub, Options.Create(options));
            var cache2 = new ReplicatedCache(CreateMemoryCache(), pubSub, Options.Create(options));

            await cache1.AddAsync("Key", 1, TimeSpan.FromMinutes(1));

            await cache2.AddAsync("Key", 2, TimeSpan.FromMinutes(1));

            AssertCache(cache1, "Key", 1, true);
            AssertCache(cache2, "Key", 2, true);
        }
示例#2
0
        public async Task Should_invalidate_other_instances_when_item_removed()
        {
            var cache1 = new ReplicatedCache(CreateMemoryCache(), pubSub, Options.Create(options));
            var cache2 = new ReplicatedCache(CreateMemoryCache(), pubSub, Options.Create(options));

            await cache1.AddAsync("Key", 1, TimeSpan.FromMinutes(1));

            await cache2.RemoveAsync("Key");

            AssertCache(cache1, "Key", null, false);
            AssertCache(cache2, "Key", null, false);
        }
示例#3
0
 public ReplicatedCacheTests()
 {
     sut = new ReplicatedCache(CreateMemoryCache(), pubSub, Options.Create(options));
 }