Example #1
0
        public async Task Can_RemoveAll_and_GetKeysStartingWith_with_prefix()
        {
            var cache = Cache.WithPrefix("prefix.");

            await cache.SetAsync("test_QUERY_Deposit__Query_Deposit_10_1", "A");

            await cache.SetAsync("test_QUERY_Deposit__0_1___CUSTOM", "B");

            var keys = (await cache.GetKeysStartingWithAsync("test_QUERY_Deposit").ToListAsync()).ToList();

            Assert.That(keys.Count, Is.EqualTo(2));

            await cache.RemoveAllAsync(keys);

            var newKeys = (await cache.GetKeysStartingWithAsync("test_QUERY_Deposit").ToListAsync()).ToList();

            Assert.That(newKeys.Count, Is.EqualTo(0));
        }