Module

middleware._redis_rate_limit

Redis-backed rate limit backend. Requires redis package.

Classes

RedisRateLimitBackend 2
Redis-backed sliding window rate limiter.

Redis-backed sliding window rate limiter.

Methods

check_and_update 5 tuple[bool, int]
async
async def check_and_update(self, key: str, now: float, *, requests: int, window_seconds: int, block_seconds: int) -> tuple[bool, int]
Parameters
Name Type Description
key
now
requests
window_seconds
block_seconds
Returns
tuple[bool, int]
Internal Methods 1
__init__ 2
def __init__(self, redis_url: str, key_prefix: str = 'chirp:ratelimit:') -> None
Parameters
Name Type Description
redis_url
key_prefix Default:'chirp:ratelimit:'