Skip to content

Releases

v0.3.1

Choose a tag to compare

@github-actions github-actions released this 29 Oct 14:03
2651fa9

🔄 Changed

  • Python 3.15 is supported (requires-python >=3.11,<3.16).

Full Changelog: v0.3.0...v0.3.1

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 19 Oct 18:22
c4bbac2

⚠️ Breaking

  • ddredis.decorators is removed. GenericCache suppresses RedisError through safe_call(default_result=None, exceptions=(RedisError,), capture_exception=False) from ddutils 0.4, which handles coroutine functions, and keeps the decorator private. Code that imported suppress_redis_errors uses ddutils.safe_decorators.safe_call with the same arguments.
  • Requires redis >= 6, < 9. The README documents the client's default retries (3 attempts with exponential backoff and jitter), which redis-py has since 6.0; 5.x retried once without a pause, so the documented production create_func did not do what it said there. The CI matrix now tests redis 6, 7 and 8.
  • Requires ddutils >= 0.4.0, < 0.5.0.

🔄 Changed

  • The GenericCache docstring no longer claims msgspec compatibility: a Struct has neither model_validate_json nor model_dump_json. Its example wires the client registry with process_loop_scope from ddutils 0.4.0.

📝 Docs

  • GenericCache: the checks at class definition, the key format :<snake_case_domain>:<key>, get_list / delete_by_filters as SCAN MATCH over the whole keyspace, an entry that does not deserialize reads as a miss, the jitter is ttl // 10 and so zero under 10 seconds, the client may run with or without decode_responses.
  • RedisLock: the full signature RedisLock(client_factory, key, timeout=10.0, blocking=False, *, alias=None), the token-only design that borrows the client for every call, key stored as given, AlreadyAcquiredError also when a blocking wait runs out, not reentrant but reusable after release(), extend() on an expired key raises redis-py's LockNotOwnedError and either without acquire() raises LockError.
  • RedisFeatureFlagStorage: the signature with alias and key, the JSON record format, the strict parsing (an extra key is as malformed as a wrong value), a malformed record reads as the defaults and so disables its flag, get_map keeps the valid records.
  • The layout follows dd-lib-stub, with a Compatibility section.

Full Changelog: v0.2.0...v0.3.0

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 18 Oct 18:36
dec2acc

🔄 Changed

  • RedisLock takes the client from a ConnectionManagerFactory like GenericCache does, with an optional alias: RedisLock(client_factory, key, timeout=10.0, blocking=False, *, alias=None). The lock borrows the client inside every call and keeps only its token between them, so a KafkaConsumerMaker can be wired with lock_kwargs={'client_factory': redis_client_factory, 'timeout': 300} and no client has to be opened up front. release / extend without an acquired lock raise redis-py's LockError, as before.
  • GenericCache.client_factory, RedisFeatureFlagStorage and RedisLock type the factory as ConnectionManagerFactory[Any, Redis, Any], so a project's ConnectionManagerFactory[Alias, Redis, ConnectionManager[Redis]] passes the type checker.

⚠️ Breaking changes

  • RedisLock(redis_client, key, ...) → RedisLock(client_factory, key, ...).
  • Requires ddutils 0.3.3.

Full Changelog: v0.1.1...v0.2.0

v0.1.1

Choose a tag to compare

@github-actions github-actions released this 18 Oct 17:31
75906a2

🚀 Added

  • feature_flags.RedisFeatureFlagStorage(client_factory, *, alias=None, key='feature_flags'): the Redis backend of ddutils feature flags. One hash, the field is the flag name, the value its JSON record (enabled, proportion, payload); the client comes from a ConnectionManagerFactory like the cache's; rename is one MULTI/EXEC pipeline. Redis errors raise FeatureFlagStorageError, so FeatureFlags keeps serving the last known values while Redis is down; a value that does not parse or validate is logged and read as the defaults.

Requires ddutils 0.3.2.

Full Changelog: v0.1.0...v0.1.1

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 14 Oct 14:58
ea04c2c

🔄 Changed

  • GenericCache no longer holds a Redis client. client_factory, a ConnectionManagerFactory from ddutils called with alias, hands the client out for every call, the way a ddsql adapter runs a query inside factory(alias=...). The factory owns the client's scope (a ScopedRegistry per alias, one client per process and event loop, since redis.asyncio connections bind to the loop they were opened in), its lazy creation and its close on shutdown through close().

⚠️ Breaking changes

  • GenericCache.redis_client → client_factory (+ optional alias); close the clients with client_factory.close() on shutdown. RedisLock still takes the client of one block as before.
  • Requires ddutils 0.3.1.

Full Changelog: v0.0.3...v0.1.0

v0.0.3

Choose a tag to compare

@github-actions github-actions released this 14 Oct 11:50
3351e70

🔄 Changed

  • Requires ddutils >= 0.3.0, < 0.4.0. ddutils 0.3.0 replaced the get_builtin_base_type / convert_to_builtin helpers of 0.2.4 with get_base_value_type / convert_to_base_value; this library used neither, so nothing changes in its behaviour. The previous < 0.3.0 pin kept the new ddutils out of every project depending on this library.

Full Changelog: v0.0.2...v0.0.3

v0.0.2

Choose a tag to compare

@github-actions github-actions released this 04 Oct 18:16
23f1f70

🚀 Added

  • Python 3.11 support. The package now runs on 3.11–3.14, like the rest of the dd* libraries.

Full Changelog: v0.0.1...v0.0.2

v0.0.1

Choose a tag to compare

@github-actions github-actions released this 04 Oct 17:51
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