✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
public class RateLimitDecorator : IApi
{
private readonly IApi _inner;
private readonly TokenBucket _bucket;
public RateLimitDecorator(IApi a, int m) => (_inner, _bucket) = (a, new TokenBucket(m));
public Response Call(string ep)
=> _bucket.Take() ? _inner.Call(ep) : Response.TooManyRequests();
}
Що спільного у всіх Decorator’ів?