This release is a major architectural rewrite focused on structured concurrency,
predictable resource lifetimes, and safer defaults. See the
Migration guide
for upgrade instructions.
Features
-
Migrate entire library to
anyio, adding structured concurrency andtriosupport -
Command API
- Allow chainable
coredis.commands.CommandRequest.transformmethod to accept inline callbacks
to transform command responses - Added
coredis.commands.CommandRequest.retrychainable method to the response from all commands
to allow using retry policies individually with a request instead of having to apply it on all requests
issued by a client
- Allow chainable
-
Pipeline
- Pipelines execute automatically when their context exits - results are accessible in a type-safe way
- Cluster pipelines now support
coredis.commands.Scriptinstances
-
Scripting
coredis.commands.Scriptandcoredis.commands.Functioncan now be called with
optional callbacks to transform the raw response from redis before returning it. This is supported
by their associatedcoredis.commands.Script.wrapsdecorators as well.- Responses from
coredis.commands.Scriptandcoredis.commands.Functioninstances can now
also be used withcoredis.commands.CommandRequest.transformorcoredis.commands.CommandRequest.retry. - Add a
coredis.commands.function.wraps.verify_existenceflag to library
coredis.commands.function.wrapsto optionally skip local validation and optimistically call it
-
Retry Policies
- Retry policies now allow infinite retries & retry deadlines.
- Retry policies now support retrying when the raised
ExceptionGroupcontains a matching exception coredis.retry.ExponentialBackoffRetryPolicynow supportscoredis.retry.ExponentialBackoffRetryPolicy.jitter
-
Miscellaneous
coredis.Redis.lockadded as a convenient accessor
for the Lua-based lock:coredis.patterns.lock.Lock(Previously found incoredis.recipes.LuaLock)- Add
coredis.Redis.xconsumerfactory method to create a single or group stream consumer - Improve guarantees of calling subscription methods on
coredis.patterns.pubsub.PubSubinstances.
Using acoredis.patterns.pubsub.PubSub.subscription_timeout, the acknowledgement
of subscription to a topic or pattern can be guaranteed before proceeding with listening to messages
Breaking Changes
-
All classes (clients, connection pools, PubSub, pipelines, stream consumers, Sentinel clients) must be
used with their async context managers for initialization/cleanup. This ensures a predictable and
unified resource lifecycle management model. -
Users should replace
coredis.cache.TrackingCachewithcoredis.patterns.cache.LRUCachewhen
providing a cache instance to the clients. Cache size can no longer be bound by byte size and only
coredis.patterns.cache.LRUCache.max_keysis supported -
Connection pools are now always blocking. Non-blocking commands are multiplexed over shared connections and released
back to the pool immediately after being queued and thus most workloads naturally converge to using a single active connection.
Pool exhaustion mainly occurs when the workload relies on blocking operations (e.g. pubsub, pipelines, blocking list commands),
making a unified blocking model simpler and more predictable. The explicit blocking variantscoredis.BlockingConnectionPool
andcoredis.BlockingClusterConnectionPoolhave been removed. -
Connection pool acquisition timeouts now raise
TimeoutErrorinstead of
coredis.exceptions.ConnectionError. -
Pipeline
- Pipeline instances can no longer be awaited and must be used as async context managers
- Pipelines no longer expose an explicit
coredis.patterns.pipeline.Pipeline.executemethod and instead
execute automatically when their context exits coredis.Redis.pipelineis no longer an async method- The
watchesparameter has been removed from the pipeline constructor - Drop support for explicit management of
WATCH,
UNWATCH,MULTIin pipelines. This is replaced by thecoredis.patterns.pipeline.Pipeline.watchcontext manager.
-
Stream consumers can no longer be awaited and must be used as async context managers to ensure initialization
-
coredis.Redis.pubsub,coredis.RedisCluster.pubsub&
coredis.RedisCluster.sharded_pubsubnow only accept keyword arguments -
When defining type stubs for FFI for Lua scripts or library functions, keys can only be distinguished
from arguments by annotating them withcoredis.typing.KeyT -
Module reorganization
- Move Pub/Sub, Pipeline, Stream, Cache and Lock submodules to
coredis.patterns coredis.commands.pubsub→coredis.patterns.pubsubcoredis.pipeline→coredis.patterns.pipelinecoredis.stream→coredis.patterns.streamscoredis.cache→coredis.patterns.cachecoredis.lock→coredis.patterns.lock
- Move Pub/Sub, Pipeline, Stream, Cache and Lock submodules to
Removals
- Drop support for
RESPversion2 - Remove
coredis.commands.Monitorwrapper - Remove
coredis.modules.RedisGraphmodule support
Compatibility
- The clients no longer check if a module is loaded at initialization. Therefore a module command issued
against a server that doesn't have the module will not fail early and instead result in an
coredis.exceptions.UnknownCommandErrorexception being raised - Add
coredis.modules.response.aggregation.AggregationType.COUNTALLand
coredis.modules.response.aggregation.AggregationType.COUNTNANaggregation types to
coredis.modules.TimeSeries - Add
coredis.modules.Search.create.indexallargument tocoredis.modules.Search.create - Add
coredis.Redis.vsim.nothreadargument tocoredis.Redis.vsim - Add support for
VRANGEvector set command (coredis.Redis.vrange) - Add support for
FT.HYBRIDsearch command (coredis.modules.Search.hybrid)