Repository navigation
v0.0.1
🚀 Added
GenericCache[DomainT]: an async JSON cache for domain objects in Redis. Subclass it with the domain type and aredis_client, getget,create,update,delete,get_list(key_prefix)anddelete_by_filters(key_prefix). Keys are prefixed with the snake_case domain name (:profile:42), the TTL defaults to 5 minutes and gets ±10% jitter so entries created together do not expire together. Any object withmodel_validate_json/model_dump_jsonworks (pydantic, msgspec, your own).RedisLock: a distributed lock as an async context manager over redis-py'sLock. A second holder getsAlreadyAcquiredErrorinstead of waiting (blocking=Trueto wait up totimeout).extend()resets the TTL totimeoutfrom now rather than adding to it, so a heartbeating holder that dies does not leave the lock held for the sum of its beats.release()tolerates a lock that already expired.suppress_redis_errors: a decorator for async functions that turns anyRedisErrorintoNone, so a Redis outage degrades a cache to "miss" instead of failing the request.GenericCachemethods use it.
Supports Python 3.12–3.14 and redis-py 5–8.
Full Changelog: https://github.com/davyddd/ddredis/commits/v0.0.1