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.0.1.tar.gz
(181.3 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38d77a5c0970e6628bb8b38b1b7f5aedfe872e34ea9d293260b291e373b75582 |
|
MD5 | 5eba0984f71cc420e5ba41a656bcae28 |
|
BLAKE2b-256 | 7f24a902ababd2ceacb717cef88b06ef234708d6a5798ab2818b394e70d2b1f7 |
Close
Hashes for coredis-4.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0d0a1d4da99f19a8953670da2c485bc3212d41db66cbf59627b838b8a9e16f9 |
|
MD5 | a02a70e7032ff98608f5938dfc9a07cc |
|
BLAKE2b-256 | d99accbc27d9c5c698ec605822318353f0b034a9861b7415974bd5a3b26ce74d |
Close
Hashes for coredis-4.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 804d20d7dda8828903e609dcc8fd805f430ba444003ed8665ffb025e468560f2 |
|
MD5 | f6d3a714d8b1fcdbcb4a271ddac595c4 |
|
BLAKE2b-256 | 7abe56a78836b7c66c6c781f7c5b71130cd1d9c95fbec55bb02dcadfd1d309d9 |
Close
Hashes for coredis-4.0.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32adc65e4b30867f4253c732dd96a97f44cd0e64195c2715beda79f45aa6be1a |
|
MD5 | 9ac689d15d63432bd12b8b168695d650 |
|
BLAKE2b-256 | 34d111e7a9f7662d9fa133fb60e98022bc22a630fd9598970c406c1750022846 |
Close
Hashes for coredis-4.0.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d631464b7487657c272deefea62304257dcc31b786386330e070832fd96ab160 |
|
MD5 | 264bf525a5774ec0d8f9d99e3e2d704d |
|
BLAKE2b-256 | 28c4e936a59136e5e7ee4a71d87d84c625f6c5eea6e0bd5a60bc4d0b2c312cde |
Close
Hashes for coredis-4.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 926f3c84cf31facd8137c638e486f55df35d7987121b4d943a2e1d1aaacb8408 |
|
MD5 | c809183904e10400f1ae2c0a87679cfe |
|
BLAKE2b-256 | ddecd3ccfba14b18d3a86456569b78981f87cd44562d7bb10cba23603f074307 |
Close
Hashes for coredis-4.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed7af366eaf302bd03783567e0a00ff62cd1c53360ed320a47baf8dd5b467895 |
|
MD5 | b7b6700853eef78a725cf6f7329f1764 |
|
BLAKE2b-256 | 2fddc42c36034cc1e517a8a36160387de449d74351411bf6d9c42b90c6387956 |
Close
Hashes for coredis-4.0.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c02665df04d0377b19f2accd21855da4cce427a0c624dd43f1475fa276c41de |
|
MD5 | 0bb3c03f4be949ae71257c71acaaa28a |
|
BLAKE2b-256 | 918b92b27a02cdd2fc45f5ed0821b198ad3bc5c4371003569150016db1ef8ee9 |
Close
Hashes for coredis-4.0.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a81c3b92375482a6f89baa13dd2c42113475d98ac10ab17e783e55b07bc02b6 |
|
MD5 | 920201d91a6fc599b6e64c25e207eff2 |
|
BLAKE2b-256 | d84a5a563f2ca56d38340bc2e7b79b377c365c16ee3fd5d4345f274ea08c5b78 |
Close
Hashes for coredis-4.0.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c400be24cb32570b3dedb43fd0f88cca564c2d4accc13ca6db5ed0f246a5141 |
|
MD5 | af62e6d7ba48ba31cd58a49fda503717 |
|
BLAKE2b-256 | cbc396b0a1c7ffe1a7c13f5900ac6a35e5dc847282471b29542237a0574f2a98 |
Close
Hashes for coredis-4.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 078af9a0c87881890d4ab09584d2efd27942bef8b2ff52634a2fa85c047c0971 |
|
MD5 | 45c5c5f36cd86ebc656443e13ac51daa |
|
BLAKE2b-256 | bd34ee79d404e276abe62b688b140266f1d3f869a1d473d81c4d7ce27311fe44 |
Close
Hashes for coredis-4.0.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2c065e943591086c5c3fb997643cbdab62654a10ba155f644422c748de43966 |
|
MD5 | 22b8e21afb62557b5df13a3522ec123d |
|
BLAKE2b-256 | 0f3fd542c1339b52b073ef7336e9b45f9ee247bc082615729234c7be40d96584 |
Close
Hashes for coredis-4.0.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07ece5b489bafcdfbd7ef907f201d482ff59d94b5d7707299901b6470101896d |
|
MD5 | c4215695082e7de477a1d1f0db524334 |
|
BLAKE2b-256 | 9339af0a975791d11ee00a65f0cd1bf192ece7018ae5868b60c908c2f05f0722 |
Close
Hashes for coredis-4.0.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9e13daeb3f223ec8566d0a138d065edf0da7d784440c32b7ccb593a4011a6f1 |
|
MD5 | e78e3a1b380c83ab755667948f032ad4 |
|
BLAKE2b-256 | f4c44ea21689255d6e9da2b0fcbf3c06d2d8d4db688d1d7a4ebd0f6c4ecb84ac |
Close
Hashes for coredis-4.0.1-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 922ee4b7c387ae448653564f916aba707d378c783346985d0cb30a87926ac2f9 |
|
MD5 | dc42ed1594a885b6c8383cea2f1b9433 |
|
BLAKE2b-256 | 00e78c194622f82a7abd1af415f27e741953ae3369db0b53c0f549172ec46382 |