Project History#

coredis is a fork of the excellent aredis client developed and maintained by Jason Chen.

aredis already had support for cluster & sentinel and was one of the best performing async python clients. Since it had become unmaintained as of October 2020 The initial intention of the fork was add python 3.10 compatibility and coredis 2.x is drop-in backward compatible with aredis and adds support up to python 3.10.

Divergence from aredis & redis-py#

Versions v3.0.0 and above no longer maintain compatibility with aredis. Since aredis mostly mirrored the redis client, this inherently means that coredis diverges from both, most notable (at the time of writing) in the following general categories:

  • API signatures for redis commands that take variable length arguments are only variadic if they are optional, for example coredis.Redis.delete() takes a variable number of keys however, they are not optional thus the signature expects a collection of keys as the only positional argument

    async Redis.delete(keys: Parameters[KeyT]) int

    Delete one or more keys specified by keys


    The number of keys that were removed.

    Redis command documentation: DEL

  • Redis commands that accept tokens for controlling behavior now use PureToken and the coredis methods mirroring the commands use Literal to document the acceptable values. An example of this is coredis.Redis.expire().

    async Redis.expire(key: KeyT, seconds: int | timedelta, condition: Literal[PureToken.NX, PureToken.XX, PureToken.GT, PureToken.LT] | None = None) bool

    Set a key’s time to live in seconds


    if the timeout was set or not set. e.g. key doesn’t exist, or operation skipped due to the provided arguments.

    Redis command documentation: EXPIRE


Default RESP3#

coredis version 3.x supported selecting the protocol version to use when parsing responses from the redis server and defaulted to the legacy RESP protocol. Since coredis has dropped support for redis server versions below 6.0 the default protocol version is now RESP3.


coredis versions 2.x and 3.x would default to a hiredis based parser if the dependency was available. This behavior was inherited from aredis which inherited it from redis. Though hiredis does provide a significant speedup when parsing responses for large nested bulk responses, coredis has made sufficient improvements in performance including using mypyc to provide a native speedup when possible and therefore no longer supports multiple parser implementations and always uses coredis.parser.Parser.