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
- 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.8
- 3.9
- 3.10
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.1.0.tar.gz
(184.2 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 475154145db510f376b24b3074a556fb4b75b8f70cccd1f8b07a60ccfe4df4e4 |
|
MD5 | a9f908be60cef2f5a85483e56e15102e |
|
BLAKE2b-256 | c079404082f020071136f81d1d500794e580b0e3731204003cfa9128e28f5756 |
Close
Hashes for coredis-4.1.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f08de0e8f63b3739eae750ebfab22ea3512491f1655db859bca7cba58914cc5 |
|
MD5 | b2ab48d6fe048a2e1647760266f23c42 |
|
BLAKE2b-256 | f72d7725979616703e5a9a9be673aceecdf8aafeb01b4ae3aed8746234e8dcad |
Close
Hashes for coredis-4.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b884fb69f99f586cf4fe6baaeb4137773790915faeb4e867f5d4db695b7abaf |
|
MD5 | d1a0808fbb0afe6718c6bbb69e6cbb4a |
|
BLAKE2b-256 | b56399f4907ff1dcd2654f8335838abedfd8b3ad19fa0af7f3acee9de78a7c2b |
Close
Hashes for coredis-4.1.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0243348febb9fae603b1f339b9fe7d75e5e57cc8cf8c81b89b4f2b5b1d708733 |
|
MD5 | b743f6b328fe46516eec11f1804f9c04 |
|
BLAKE2b-256 | 162189088b2bffdf104bd67ab4856c11581739c23e8bd8f24e803077a32fe1cf |
Close
Hashes for coredis-4.1.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 763b73a86c6f5576724501f476f0b437879d4b08c0aa2208a54d73b1a7606fcb |
|
MD5 | 8a849563246d32d85b9585c628f677b8 |
|
BLAKE2b-256 | 275bf15ee8a0636ef6fed44153f1d643b6daede55241b38e966020294199459e |
Close
Hashes for coredis-4.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29a72b197ecf1633338ed87f23e802eaa46bc1b804284fc3c83a5ca81cfc05ca |
|
MD5 | 8eff0b5179121e841f8ef917b30f7fbb |
|
BLAKE2b-256 | 54c5bdb64759f99d4ab57c04239121fd8aa2985ad9f5262e6abbcfd87d46f4db |
Close
Hashes for coredis-4.1.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd47069d9c1530e0af43dd372e50a51fdb1194d7f1b6508bb3a4bc47516e12f8 |
|
MD5 | 91a49f7dddb7a4fb5c06e2fe9def8c44 |
|
BLAKE2b-256 | 07de3518cc7b3c1bcc09f9989b3975e0e6572debf9306d9a8b8c8df33fc5788f |
Close
Hashes for coredis-4.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10ed0ff473f6bc2164434334ce56d4e3f3259ffd969b8af1e166e2a6d4edfdb3 |
|
MD5 | fffd29e5e8abdb47e2b8fd8cbac1a988 |
|
BLAKE2b-256 | 30331181c7dcbe0f8dc273955d37fb71e364b0fa84dfe16dde7d555619bee314 |
Close
Hashes for coredis-4.1.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 683142fe963baf09edbfba4258f4655b5f22732b1d56f5abbd0c26de0d30c72e |
|
MD5 | 8fad3e3a0441fa0f6a185b1ecb9b3937 |
|
BLAKE2b-256 | 2230af12f8bb6c61c43a1f366d98a000a700ab8ecc0a494c3f79f91d29719d82 |
Close
Hashes for coredis-4.1.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e7256e947064b619b77efb43266e5fdf13b44fba5b3184edeccfbb1fa2ac1cd |
|
MD5 | f56470f1cc68685470e69944b3cedfee |
|
BLAKE2b-256 | 8e58ca588e7c30b448a30d788b622816ecc5df0e64b4959ef9f4685a5cac085a |
Close
Hashes for coredis-4.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 028caf3e31dd7eb2bc229ec027b9866e528ad0c8965c8d66eb9818d93736e3d8 |
|
MD5 | d17ece2bbc4662ab0228dd9dcc08d92c |
|
BLAKE2b-256 | a31167ea008e475e838b69d169b24bfbd35b03ad9604b3b1b730664789a405e0 |
Close
Hashes for coredis-4.1.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 835ab8f7716601a3b007254270fe97fcfd938c8efe0ca3c3e3d2d4e6156fc80c |
|
MD5 | 755f6abf610bd1684b03ad3a81685aba |
|
BLAKE2b-256 | 36578ed2e67dfe1a8a8d1603d0b376cd1c4bd01a41142af200644737bdac228f |
Close
Hashes for coredis-4.1.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 714b207a02b2d2ef3d05c955826cce37ed0c69edbc77aa0faa321c044b357ab2 |
|
MD5 | e2b62689f81f7cf756eac1fe5191f504 |
|
BLAKE2b-256 | 86a4ec3cbc7d5d86c25247a149b6c81d774c87bb505728e443769884693571a8 |
Close
Hashes for coredis-4.1.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dbda1922d4fd8f2965e693ee1c07d298b94c356eeae3fc958d42af277eada38 |
|
MD5 | c62d7a13e90921272ddb83ae7638d541 |
|
BLAKE2b-256 | 561bef211989ea5a20e2f974dbe6f04704a2edbda91f40b653640d439f786d9c |
Close
Hashes for coredis-4.1.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9de996a786240e7051dad783ec8b11ed513eb3034b51ce061576317cd3f8167 |
|
MD5 | 55c9abf6886f993a2aab2cbc681b6984 |
|
BLAKE2b-256 | 36071a90010da4aafe1d2bf299f27c28a6e1ecc55939c08e4f27566a0bdbd90c |