public async Task <bool> Matches(HttpContext context, IDistributedCache cache) { var discriminator = await Predicate.Invoke(context); if (string.IsNullOrEmpty(discriminator)) { return(false); } var period = await Period.Invoke(context); var limit = await Limit.Invoke(context); var key = $"{Name}:{discriminator}"; var count = await cache.CountAsync(key, period, context.RequestAborted); return(count > limit); }