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.2.0.tar.gz
(185.1 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e1025f844e8092f565c7b424f3cd2250625a5ee5ce923c2bc000ff169036dc1 |
|
MD5 | 4f213397b783e50c648ab10d1d9b3e91 |
|
BLAKE2b-256 | 90f9c5d970efcd1a1186c7bfae8dcac992963236feb364b6ac3eaeb73fff9f3a |
Close
Hashes for coredis-4.2.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46a67f870890f3ce8e1ea7027281380affc468c70bb6d1f709730a6cdbc9ef39 |
|
MD5 | 8b1e66bfabd77ea3f451f39c70414532 |
|
BLAKE2b-256 | ef4ac3dfab51f06befc58fc644c97dbad742edae4d73a70e23656bb95879fbf7 |
Close
Hashes for coredis-4.2.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 946eea8b4a8f24007da58822f018f81ca217a10f33c5db6c2097269c39bd1c82 |
|
MD5 | 4683b7f5410e7971144ead4fd16eb74f |
|
BLAKE2b-256 | ccbb5714f3a179fb84cae86efa1fb8132b9c10e53e77d8d3959ecb8bdd478dde |
Close
Hashes for coredis-4.2.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e0949319471aa43ca22b8fea5bf779becc8574e53c635881aed4aad8b74988f |
|
MD5 | 4e82e05140ea5b083dec9ab3a502ecf0 |
|
BLAKE2b-256 | 3867469f2e23f87315cb7279ae44c88644e609463061caaf5acde0286e414795 |
Close
Hashes for coredis-4.2.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d3bc506df5a972c8c04c9e142937339fa58aeadc5878e5ac7a58292f03a8f74 |
|
MD5 | fa0786e6610b1167ac0c9f3f613c4cc2 |
|
BLAKE2b-256 | fed57581d29b8a3af17005ee8fd8ceecb304ae2c800b95a499520b834c3f4404 |
Close
Hashes for coredis-4.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f91e6529b019a60e0c21cc70a4c2344023168cd324582ad93720a4a063657b3 |
|
MD5 | e80863fd27fbfff6bf881678d2f211eb |
|
BLAKE2b-256 | cac904075ea2b88649a87f3b49c6f6427eebf73b9af28bb9240c67ee7172f519 |
Close
Hashes for coredis-4.2.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae3d6cb3aca408eaf1eaf70365e6faf5d82edafde3c5b3e34c678967f92da542 |
|
MD5 | 9f607964d5a42eaf534d8e838eee43a7 |
|
BLAKE2b-256 | 41ecf89c5713be413b7d52eb5b93528e0aa7c88a6892e531511bed0b2d1857cd |
Close
Hashes for coredis-4.2.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b7dae5343da5932f12d19c49f83c0a3c6ac756d99686da1cc350ec70db0d1ce |
|
MD5 | c21c8337bc6e20f7167b521a6b53b88f |
|
BLAKE2b-256 | 5c15e56d28ff4261d4cfbdf4cbee7867750798ec5f6382d7deac30cd37c33440 |
Close
Hashes for coredis-4.2.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94eccfe2d3f8757d42ee51fa22bbe2d4461b5c350cc5d344b4045e81af08a9d8 |
|
MD5 | ce275685935ec05cfef2d76d2395add0 |
|
BLAKE2b-256 | b9d82429ac1914ccb7b6a3b31793398c82fb14c28393d32beb656876cb6d0c56 |
Close
Hashes for coredis-4.2.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6527088e30a9855ebc48f6d56eca6039fe691cf8201f6600ecebda72bbc97125 |
|
MD5 | 7f61c983c8ab3339e8c8d768e1922588 |
|
BLAKE2b-256 | fdc3be88fc5585888ebf0563a49a3959b8773c7fc81800ecb03ea29b2ff875f5 |
Close
Hashes for coredis-4.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b46ef334fa11e8776fbeefdee90d876baee12bc6a9d2d580b738ca48d371eb46 |
|
MD5 | 2fa063b19e8fc2619c434f7e9f446fe6 |
|
BLAKE2b-256 | e96d96e981885ff5112eeba8441f967323be07e3f7814b0fa87f61224b9fdf1c |
Close
Hashes for coredis-4.2.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7adcf49c6e8d842b5a394ac24dafa356e3738de7b0d099c4c8a4abff3a452f12 |
|
MD5 | 7eeee4b54d163e5fda857d6458f66ccb |
|
BLAKE2b-256 | d13926b3fe705de9278a83a33348287b2c757233871b9785081bfb5a1e199130 |
Close
Hashes for coredis-4.2.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3495772bbf47d6c174e5c6d24b3a3f7018e611d9e6a0e8ef726ac5b05d651344 |
|
MD5 | 40046534cc8bf330d6825064322ac03a |
|
BLAKE2b-256 | a52c70fcf67442143651aee49dfa4e8ab0c8dd407899cdd2168c69e9ddc88874 |
Close
Hashes for coredis-4.2.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bda4f1988dd92181a5fbf403174d07b1b41946bc97a0afeb1527df810ae00523 |
|
MD5 | 950f3382c4964897f106a0f2354cfaa5 |
|
BLAKE2b-256 | 62befa459a9028bb07b3fb3a1b256fdb5f34f3c09d82fee9f8bf5d04c28546f4 |
Close
Hashes for coredis-4.2.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2b001e1a345a2f05b3fac0b77aabc1f18fa3d4937ec24420ac833a7c151fcd6 |
|
MD5 | 794fe6fa30bf92b0f614a346b2b388bf |
|
BLAKE2b-256 | 6964967d95a2072c0892bd8fc8643d9e213bc3ec786f7c38178d596932a26d36 |