Python async client for Redis key-value store
Project description
coredis
coredis is an async redis client with support for redis server, cluster & sentinel.
Installation
To install coredis:
$ pip install coredis
Feature Summary
Deployment topologies
Application patterns
- PubSub
- Sharded PubSub [
>= Redis 7.0
] - Stream Consumers
- Pipelining
- Client side caching
Server side scripting
- LUA Scripting
- Redis Libraries and functions [
>= Redis 7.0
]
Miscellaneous
- RESP3 Protocol Support
- Public API annotated with type annotations
- Optional Runtime Type Validation (via beartype)
Quick start
Single Node client
import asyncio
from coredis import Redis
async def example():
client = Redis(host='127.0.0.1', port=6379, db=0)
await client.flushdb()
await client.set('foo', 1)
assert await client.exists(['foo']) == 1
await client.incr('foo')
await client.incrby('foo', increment=100)
assert int(await client.get('foo')) == 102
await client.expire('foo', 1)
await asyncio.sleep(0.1)
await client.ttl('foo')
await asyncio.sleep(1)
assert not await client.exists(['foo'])
asyncio.run(example())
Cluster client
import asyncio
from coredis import RedisCluster
async def example():
client = RedisCluster(host='172.17.0.2', port=7001)
await client.flushdb()
await client.set('foo', 1)
await client.lpush('a', [1])
print(await client.cluster_slots())
await client.rpoplpush('a', 'b')
assert await client.rpop('b') == b'1'
asyncio.run(example())
# {(10923, 16383): [{'host': b'172.17.0.2', 'node_id': b'332f41962b33fa44bbc5e88f205e71276a9d64f4', 'server_type': 'master', 'port': 7002},
# {'host': b'172.17.0.2', 'node_id': b'c02deb8726cdd412d956f0b9464a88812ef34f03', 'server_type': 'slave', 'port': 7005}],
# (5461, 10922): [{'host': b'172.17.0.2', 'node_id': b'3d1b020fc46bf7cb2ffc36e10e7d7befca7c5533', 'server_type': 'master', 'port': 7001},
# {'host': b'172.17.0.2', 'node_id': b'aac4799b65ff35d8dd2ad152a5515d15c0dc8ab7', 'server_type': 'slave', 'port': 7004}],
# (0, 5460): [{'host': b'172.17.0.2', 'node_id': b'0932215036dc0d908cf662fdfca4d3614f221b01', 'server_type': 'master', 'port': 7000},
# {'host': b'172.17.0.2', 'node_id': b'f6603ab4cb77e672de23a6361ec165f3a1a2bb42', 'server_type': 'slave', 'port': 7003}]}
To see a full list of supported redis commands refer to the Command compatibility documentation
Compatibility
coredis is tested against redis versions 6.0.x
, 6.2.x
& 7.0.x
. The
test matrix status can be reviewed
here
coredis is additionally tested against:
hiredis >= 2.0.0
uvloop >= 0.15.0
hiredis
if available will be used by default as the RESP (or RESP3) parser
as it provides significant performance gains in response parsing. For more
details refer to the the documentation section on Parsers
Supported python versions
- 3.8
- 3.9
- 3.10
Experimental Backends
coredis has experimental support for the following redis compatible backends:
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for coredis-3.11.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db9291a37dff41ce29a62f87e5325fea298c9d872fa3987114227c0ad9313523 |
|
MD5 | cf15da192001f6194c02034c984994d5 |
|
BLAKE2b-256 | 36ae273a1d45e2a916e5582c1eef384573a0be6c8fbd0590411292f21b1e7031 |
Hashes for coredis-3.11.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f3843d4866818d0ef108a029f09d3420df42141f3dc3bac92913c0d21b27ffe |
|
MD5 | 04fdae606d3ffca315c4c4422a39e6f4 |
|
BLAKE2b-256 | 6a0add0055ee418882f1466538c0eb5b0ce58b78237cc628b2144bb7289c6ce2 |
Hashes for coredis-3.11.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 232d8396d83727a07dde79c707d6a40fe66742d1b4c58fd51f1f87363cc069e5 |
|
MD5 | a310dc1a280cbd4c78e188bae7e6504f |
|
BLAKE2b-256 | 11cd2d2dbb76550a42219e41b2f42442efaf20e537a8063262c88b8564c882c0 |
Hashes for coredis-3.11.4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7b88199cf349306c1ae47af2d074d2113b89c35edb8543ef0387d30d465fe92 |
|
MD5 | 3a159d62a65677dbe0303f15aadd9764 |
|
BLAKE2b-256 | 7b09f4f374f028b37309a4aa4f1e191ab3bb7a92cb96df1031e25066e89b010c |
Hashes for coredis-3.11.4-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71c7f95926297434381123cc5548a506498c29d77e3db9448817d800514fbccd |
|
MD5 | 4815853a66ce6b6ee2fbe3663f1fa595 |
|
BLAKE2b-256 | e1994bfb863f1048e1006f56856f2adf3ff9b4dfdd990da1065e5815ebd26120 |
Hashes for coredis-3.11.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd79bc82c46470e2b9c16cd63a9a3d39db6223039390e1818271ef85b187d7f9 |
|
MD5 | b8a5101730fd7e57f8c008fa0a55d0f8 |
|
BLAKE2b-256 | 2ee0bcbe11a51b622a222edbb3a9c7f30a7477b5ceea3ee6063fad4b4307f623 |
Hashes for coredis-3.11.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54f3d4f19f1ff33cefa5451c180900674f7009945e28aed65fdb876a9af2a63e |
|
MD5 | aa0fb1c5a7444018a5d99bab67e707ff |
|
BLAKE2b-256 | e3f3e1c887277453cde9d41f52ac7468ee09589349b5fb93d512a36fc278bfd1 |
Hashes for coredis-3.11.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4842b56a9095c5734f4bb0ef77a05baef0a8b0a8a55ebd6c9288e86d8792dccf |
|
MD5 | 002dd90658936e8756164afeaefc1223 |
|
BLAKE2b-256 | 8ebda02c8df4fc9e68e407f7a68e526ea2ed00d197fd89b722ccab60ad0f759b |
Hashes for coredis-3.11.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e5992fd2044ca4eb1e506c0ab7edc174ca77d94050c3e479eb79ecc0bbd74f1 |
|
MD5 | 8f2f10976d4bdb2da3dcb82074ea8fe5 |
|
BLAKE2b-256 | cc4c2e3eaf1d5d8c8820c35d87adeba0359e3d0f5291a84d3befc5e7ec3a49e0 |
Hashes for coredis-3.11.4-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fd4ddb8eeb20869e15c72d9bb71dfff90d536ce7bad8ab63d17da9b3f8c36b5 |
|
MD5 | 76a0f01ad3355f5efc42f8c6db4166e9 |
|
BLAKE2b-256 | c496637b66bd63429fb1ad1334609beb4305fc029d37fc1f046b56a633cec342 |
Hashes for coredis-3.11.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9413614858c103f54969281d614cc11e93d60658220805c118a5807d5a90aaf0 |
|
MD5 | d2a332f663b681b26ceed17202c80042 |
|
BLAKE2b-256 | 96937aa4aa7818ca416b78cd4ec96141840b2567b99438d42bb9067b3412826b |
Hashes for coredis-3.11.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2a5c0ee58fb864fbc621b38dec63ca244bcfc07b7d1a9f2a92e318b3d3d4214 |
|
MD5 | c4f07e6d8ab6aa91041e4621187e72e2 |
|
BLAKE2b-256 | 000f9c99cf538fccdc3b3af641ed79b4aa35b98b82da9fe19a4e137f5abccc48 |
Hashes for coredis-3.11.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a992806518c9b4f674ec03b94d62b93b4ba1e332312b28e43182a92aaa622e77 |
|
MD5 | b1b8ad16295bd55c101f3a2e162fbddc |
|
BLAKE2b-256 | 9e4bd1d9e72d1f765eaa435fece00e58ca01128d367ebdf7a7896c016cff8751 |
Hashes for coredis-3.11.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03e74aeba2268e609668437153af7876e4945fe2ae2d81a9a42f9d63a61a2215 |
|
MD5 | 5e24d4644be9060f0aed3aeee756db04 |
|
BLAKE2b-256 | 811cdcad2d89af415a1d98dbc2e6843c34a07b61d1fe994cce519e12978f78a8 |
Hashes for coredis-3.11.4-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82061da6b01b9c6960bdc27a5038c8cae322faeddeaa7b53d809474034ab39cc |
|
MD5 | 95235a97ff20b4b0bae5add5444b2e3a |
|
BLAKE2b-256 | 04ba1202b2e7eb33996eb0c3d7b794c22b70f8b44ee47c9beaf5af3707ac4883 |
Hashes for coredis-3.11.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f358959cba0d96e47885f783a3f8165ecb55eba0391b39386e2637ce17d2d59e |
|
MD5 | 691637ec81b1611eed7210af41c39af4 |
|
BLAKE2b-256 | 8610b1a82aac9fbabf7cf20a38b097a902f164a6bcc17c9347f336d7df28bd58 |
Hashes for coredis-3.11.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb04ea1e0323ee85acd9a34b92068000baa616d6e2ba99940c675cc508d7db2f |
|
MD5 | d7f50c51d573ad4b8409481a85141c21 |
|
BLAKE2b-256 | a2b7dbe2bb65222b0601e98ba7fb942792099015e53c45c9710d780600b993e9 |
Hashes for coredis-3.11.4-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 841dba6d2755739962947eb275468e020844643377cf0ba3f987336a8c3b0420 |
|
MD5 | d4bb739786a1fd20c84145dfa0b69e65 |
|
BLAKE2b-256 | cdcf67378f3da3d4f75fb98bc59b17d23e8c04f7c2849835667c118d5f6b6117 |
Hashes for coredis-3.11.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84d2047b592749dc048d10b138b3346fe3b99b9785b18a37d636b508188248bc |
|
MD5 | e446b6bf5d4cccae5a1e7b713ea43a90 |
|
BLAKE2b-256 | f34954c75eb510aad9587c6f671b602057f2f1994d967976827ec17fa0fa5a76 |
Hashes for coredis-3.11.4-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bb1d0ce8274085effd883b931dcf01d0bde9a2c9347a4ac3434545343f3fa15 |
|
MD5 | abcb6b783113d6cfd09c9263bfde1e04 |
|
BLAKE2b-256 | 37abf5ac195864689f41d621a4cbc4ccc232c062ac9183458dd47774e1ceb374 |