nat.plugins.redis.redis_object_store#

Attributes#

Classes#

RedisObjectStore

Implementation of ObjectStore that stores objects in Redis with optional TTL.

Module Contents#

logger#
class RedisObjectStore(
*,
bucket_name: str,
host: str,
port: int,
db: int,
password: str | None = None,
ttl: int | None = None,
)#

Bases: nat.object_store.interfaces.ObjectStore

Implementation of ObjectStore that stores objects in Redis with optional TTL.

Each object is stored as a single binary value at key “nat/object_store/{bucket_name}/{object_key}”. When TTL is configured, keys will automatically expire after the specified duration in seconds.

_bucket_name#
_host#
_port#
_db#
_password = None#
_ttl = None#
_client: redis.asyncio.Redis | None = None#
_make_key(key: str) str#
async put_object(key: str, item: nat.object_store.models.ObjectStoreItem)#
async upsert_object(key: str, item: nat.object_store.models.ObjectStoreItem)#
async get_object(key: str) nat.object_store.models.ObjectStoreItem#
async delete_object(key: str)#