ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

class RedisRateLimitStore: (source)

Constructor: RedisRateLimitStore(config, client)

View In Hierarchy

Share sliding-window quotas using a single-key atomic Redis script.

Method __init__ Build a lazy Redis connection, optionally using an external client.
Async Method close Close connections created by this store without deleting quotas.
Async Method hit Accept an attempt only when its distributed sliding quota permits.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable __client Externally owned transport. The caller remains responsible for it.
Instance Variable __owns_client Whether this object must close the client during its own cleanup.
Instance Variable __prefix Prefix applied when constructing names or storage keys.
Instance Variable __timeout Maximum duration allowed for an execution attempt.
def __init__(self, config: HTTPRateLimit, *, client: Redis | None = None): (source)

Build a lazy Redis connection, optionally using an external client.

Parameters
config:orionis.foundation.config.http.HTTPRateLimitValidated connection fields, namespace and operation timeout.
client:redis.asyncio.Redis | None, optionalExternally owned transport. The caller remains responsible for it.
Returns
NonePrepare the backend without opening a network connection.
async def close(self): (source)

Close connections created by this store without deleting quotas.

Returns
NoneRelease an owned client's connection pool.
async def hit(self, key: str, limit: int, window: int) -> bool: (source)

Accept an attempt only when its distributed sliding quota permits.

Parameters
key:strClient identity. Only its SHA-256 digest is persisted in Redis.
limit:intMaximum accepted attempts in the window.
window:intWindow duration in seconds, consistent across all workers.
Returns
boolWhether Redis atomically accepted the attempt.
Raises
redis.exceptions.RedisErrorWhen storage is unavailable or contains an incompatible key type.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

__client = (source)

Externally owned transport. The caller remains responsible for it.

__owns_client = (source)

Whether this object must close the client during its own cleanup.

__prefix = (source)

Prefix applied when constructing names or storage keys.

__timeout = (source)

Maximum duration allowed for an execution attempt.