Skip to content

redis-py-kit

Enterprise-grade Python Redis toolkit with sync/async dual-mode API.

PyPI Python 3.11+ License: MIT Status

Features

Module Description
Cache Get/Set/Delete, TTL, batch operations, @cached decorator, TTL jitter
Tiered Cache L1 local LRU + L2 Redis, read-through, negative caching
Distributed Lock Basic lock, reentrant lock, read-write lock, watchdog auto-renewal
Message Queue PubSub, DelayQueue, ReliableQueue
Streams Consumer groups, auto/manual ACK, dead-letter recovery
Bloom Filter SHA-256 multi-hash, pipeline bit operations
Counter Atomic INCR/DECR, BoundCounter, ID generator
Session Redis Hash session store, CRUD, TTL refresh
Rate Limiter Token bucket, sliding window, @rate_limit decorator
Repository Dataclass entity storage, versioning, soft delete, audit, history
Observability MetricsCollector, OpenTelemetry integration

Quick Install

pip install redis-py-kit

Quick Example

from redis_kit import ConnectionManager, Cache

conn = ConnectionManager(url="redis://localhost:6379/0")
cache = Cache(conn.sync_client, prefix="myapp:cache")

cache.set("user:1", {"name": "Alice"}, ttl="2h30m")
user = cache.get("user:1")