Пример #1
0
        public async Task Should_serve_from_cache()
        {
            await sut.AddAsync("Key", 1, TimeSpan.FromMinutes(10));

            AssertCache(sut, "Key", 1, true);

            await sut.RemoveAsync("Key");

            AssertCache(sut, "Key", null, false);
        }
Пример #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);
        }