Skip to content

v0.0.1

Choose a tag to compare

@github-actions github-actions released this 04 Oct 17:51
· 14 commits to main since this release
152f53c

🚀 Added

  • GenericCache[DomainT]: an async JSON cache for domain objects in Redis. Subclass it with the domain type and a redis_client, get get, create, update, delete, get_list(key_prefix) and delete_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 with model_validate_json / model_dump_json works (pydantic, msgspec, your own).
  • RedisLock: a distributed lock as an async context manager over redis-py's Lock. A second holder gets AlreadyAcquiredError instead of waiting (blocking=True to wait up to timeout). extend() resets the TTL to timeout from 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 any RedisError into None, so a Redis outage degrades a cache to "miss" instead of failing the request. GenericCache methods use it.

Supports Python 3.12–3.14 and redis-py 5–8.

Full Changelog: https://github.com/davyddd/ddredis/commits/v0.0.1