Storage API¶
Storage Backends¶
Memory Backends¶
aiogram_sentinel.storage.MemoryRateLimiter ¶
Bases: RateLimiterBackend
In-memory rate limiter using sliding window with TTL cleanup.
Initialize the rate limiter.
Source code in src/aiogram_sentinel/storage/memory.py
allow
async
¶
Check if request is allowed and increment counter.
Source code in src/aiogram_sentinel/storage/memory.py
get_rate_limit
async
¶
Get current rate limit count for key.
Source code in src/aiogram_sentinel/storage/memory.py
get_remaining
async
¶
Get remaining requests in current window.
Source code in src/aiogram_sentinel/storage/memory.py
increment_rate_limit
async
¶
Increment rate limit counter and return current count.
Source code in src/aiogram_sentinel/storage/memory.py
reset_rate_limit
async
¶
aiogram_sentinel.storage.MemoryDebounce ¶
Bases: DebounceBackend
In-memory debounce backend using monotonic time.
Initialize the debounce backend.
Source code in src/aiogram_sentinel/storage/memory.py
is_debounced
async
¶
Check if key is currently debounced.
Source code in src/aiogram_sentinel/storage/memory.py
seen
async
¶
Check if fingerprint was seen within window and record it.
Source code in src/aiogram_sentinel/storage/memory.py
set_debounce
async
¶
Set debounce for a key.
Source code in src/aiogram_sentinel/storage/memory.py
Redis Backends¶
aiogram_sentinel.storage.RedisRateLimiter ¶
Bases: RateLimiterBackend
Redis rate limiter using INCR + EXPIRE pattern.
Initialize the rate limiter.
Source code in src/aiogram_sentinel/storage/redis.py
allow
async
¶
Check if request is allowed and increment counter.
Source code in src/aiogram_sentinel/storage/redis.py
get_remaining
async
¶
Get remaining requests in current window.
Source code in src/aiogram_sentinel/storage/redis.py
aiogram_sentinel.storage.RedisDebounce ¶
Bases: DebounceBackend
Redis debounce backend using SET NX EX pattern.
Initialize the debounce backend.
Source code in src/aiogram_sentinel/storage/redis.py
seen
async
¶
Check if fingerprint was seen within window and record it.
Source code in src/aiogram_sentinel/storage/redis.py
Storage Protocols¶
aiogram_sentinel.storage.base.RateLimiterBackend ¶
aiogram_sentinel.storage.base.DebounceBackend ¶
Factory¶
aiogram_sentinel.storage.factory.build_infra ¶
Build infrastructure backends (rate_limiter + debounce) based on configuration.