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
- Connection Pooling
- 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
- 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:
uvloop >= 0.15.0
Supported python versions
- 3.7
- 3.8
- 3.9
- 3.10
- PyPy 3.8
Redis-like backends
coredis is known to work with the following databases that have redis protocol compatibility:
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
coredis-4.5.0.tar.gz
(187.3 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3539c0ef782e38e20a62e7b6f972487594a3069844a78587bdca1111ae8dfc21 |
|
MD5 | 4ee6084a608c4d53522fc1d9c370dae0 |
|
BLAKE2b-256 | 71816d96c19d216bb283aeec37c01462da07e28be71d432cac9ddce37c4f96af |
Close
Hashes for coredis-4.5.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25038f07cb29e3a432c9f8e6335a54f93cec797e8d2527bc04c516b508410f73 |
|
MD5 | 698be67463acac470cb9d53d776c5a92 |
|
BLAKE2b-256 | 77814df4416f115e0789cec73b9ef39aecc9728b303e48ec4aefc6db4c3d9a4a |
Close
Hashes for coredis-4.5.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4515d378ddb7f8547266f702950afc68e330268a7622dbe82d8501be487c03eb |
|
MD5 | b4c4b3506044435d641ac2acd57badba |
|
BLAKE2b-256 | ea1a5d6f8fb9365ae12fac040c7cbdd86f6a0e3921e52eb117f77ba8c086f8ff |
Close
Hashes for coredis-4.5.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 239f259338de39ddc8e71ce5e1d2e5d47521a4a56efa2b4d8edfc0ec72344e0d |
|
MD5 | 1a22041e56d8c8f88acd621261828007 |
|
BLAKE2b-256 | 797152ae2aaec7e1f9e6b15344ebca53e1789a281828befc51bf047b41f90013 |
Close
Hashes for coredis-4.5.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44b30860e23c9c9a97f3a4b638a8d6bb818619e81bd5993f17de01f9a0697e71 |
|
MD5 | a705f99527ad1595527ec08e705dbdd9 |
|
BLAKE2b-256 | 434e55d06195b887ddda99a388e129b461697b4d3d682cb22950a4fc86255fae |
Close
Hashes for coredis-4.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b54a47e689cc668c627be132df1c55449ce5621125ccd0f212362ccbcb3da441 |
|
MD5 | 23fbe4353e26b2cbba7c2313d5901981 |
|
BLAKE2b-256 | 797a5899aa1157fad4a04d59532b98368a5a6aadb3dca5151bcf56c3362cf3d5 |
Close
Hashes for coredis-4.5.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a9b8bde6542f3e34707c15ee16dc6054f4d8331969055cc74ceef4650c69a49 |
|
MD5 | ac4e45198c0a09abd924800128cb3652 |
|
BLAKE2b-256 | 9138ac0caa34a4553406c848d55fd937094f2ff1350d42d8b946d61eafb37d6a |
Close
Hashes for coredis-4.5.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8395f72e8dc788af6ec474e7a2500597bb0dff7b4eeb6cc69c4fa02be994fd79 |
|
MD5 | 4bdf67afc3cb7bb52ac354be676a1897 |
|
BLAKE2b-256 | 9269c5f1d2bb172e5c9fe08eed2c947ef3861eeff422f4679d03d5305fa5f097 |
Close
Hashes for coredis-4.5.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e53419ae569aed5faa618a21cc817c797771f341258e1f7ca9e52161c1f1051 |
|
MD5 | c21b21518bcbc8fe1813a86e738ca01b |
|
BLAKE2b-256 | 012009b0001579c0cfca71e4bb048f1986369fa00e49f0430c2c7e30023b072d |
Close
Hashes for coredis-4.5.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0681c98006acaa7602773472c1aeef8c381e49c564722a2d66a48d47da6c8bc |
|
MD5 | 69da3b9d58e582c5d92496b300f6ad9c |
|
BLAKE2b-256 | e357aadcb0c3adbf678243c511d478bf90d747619988f31d630387b588704f49 |
Close
Hashes for coredis-4.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91bb69051982e4b34d077f60afe7e2e1adb0e4b5d64e703ae75c175c3a6c0540 |
|
MD5 | 0301170dd21ce29c6b9dbe573dac5183 |
|
BLAKE2b-256 | 45579050746e1ee395fb8f89fe0a9d2814904acc47f2e7f0bcc9d77f9f78c43e |
Close
Hashes for coredis-4.5.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05ecb67fd3cca28a5304a5b3f590c0b48b9958f7081796dab42c850d9be43038 |
|
MD5 | 3c32897d924adde1b83ff1e5b7b1de58 |
|
BLAKE2b-256 | 6826ae379f1111211f917b788f5453b18b243dfdadf0304b143f0efe8c997917 |
Close
Hashes for coredis-4.5.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56cba6e8c416d500487d7312dda5bf7962d517a4096f2e18be652b2b97ca5ea6 |
|
MD5 | 0296e6121bd7a71f271ee3b2ffb8cfc0 |
|
BLAKE2b-256 | 251b434003ad29a19d37217a75473db06ee310eeefaed8ae42d320af7cf53fac |
Close
Hashes for coredis-4.5.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c6cea004c204e6d43791d400ca0661dd79acf73155c429540f9816431ce201d |
|
MD5 | 6d0ca5a3bab195ea7e2a5d3bf63a9422 |
|
BLAKE2b-256 | c4573e459e6388a00e98d833dda068efde2a1a8b270dae0006bd566785662856 |
Close
Hashes for coredis-4.5.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 100aaf79548a2ad8fb9eb455d556ea57cdcd88bc115a26d01a0b752e0cce7630 |
|
MD5 | 2f74f6f398906bff2931652b44cbe6fb |
|
BLAKE2b-256 | 144abbb0b6632fe8901cfc8c9d202179531ef4c1f3eb453d3c052df2cf89a301 |
Close
Hashes for coredis-4.5.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbcd46b96ae3ce60384ae17ab001b07beb292209ba0474b1f8992040be69f89b |
|
MD5 | 12a4cd9c6f51cdb2cf498faf6b713577 |
|
BLAKE2b-256 | 725a13fae752f05ca0a5aaa3f936cf6ef86bfa509c0548cb3668e6e0a7c4c18d |
Close
Hashes for coredis-4.5.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7152f5fbd6483863aad836dfbd198f0de1dcff22df036fe75e5b11ee529e86a0 |
|
MD5 | 0c1c04379df9a6fa67f5b084069296f3 |
|
BLAKE2b-256 | ccdc49a5129eb474072d513586fc7a1e073da58e932daed7169c62256578aab2 |
Close
Hashes for coredis-4.5.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25cac07ec32118f7fabe94d3b899f8865c57beddee7e6cf8f3369b33dad19c4b |
|
MD5 | d4cf4059299065789b75bbef8bfa18ef |
|
BLAKE2b-256 | f3df7080939714863cf4ed5b7dc7d9a44e4c68a5efe8cada8cf35bfad00d177a |