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.4.tar.gz
(188.8 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7287fa1f66bf253f482e3a50ce4deaeeeaf7f81e7b381306dca74e07a4d3bea |
|
MD5 | c3ca195329dbf62602180687f079d2b5 |
|
BLAKE2b-256 | ad792c023c8e92a461f98a55b547255f68758a7dbc1e730d7aa7dd9388750a76 |
Close
Hashes for coredis-4.5.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56bf58f55c551667805aea4f5ea937ca25707c0ce24a3d99ab90918535bb02b0 |
|
MD5 | 9fa28866658ca775fb7e636a97e89b3b |
|
BLAKE2b-256 | bb7293348497736e0d422ac739f4246c533a35daf2e6954220871b571c2eefcb |
Close
Hashes for coredis-4.5.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab80a7f80c8bd4ee821fde944547460e5bf4d93f913edd055032ca3ef74fd693 |
|
MD5 | 9904b679daf0f94ad67dd93446c8d89d |
|
BLAKE2b-256 | 6dae1963cc9578144f332a07d544e5aa2f05084c570237a102c5ab8e2d0bb0a4 |
Close
Hashes for coredis-4.5.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53ee36da5bae2a4d4769ce6b26f71b8e1edc4b4d3b47d8b7cb3a4fd09679ae25 |
|
MD5 | 8a04cc365c8dcc80fca9d77f636d6882 |
|
BLAKE2b-256 | 3703e15be1ff4ee5c177f5eb2e7dfb49f1baeefc8b23db1f5fea63eab39ac729 |
Close
Hashes for coredis-4.5.4-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cae33bd25ec9e1e6cbe449340fd376e05b594efebbecbc43a65983f0b91efae |
|
MD5 | b9c4be4c4656bfe26582000fd54741d7 |
|
BLAKE2b-256 | 5e75bdfa11e3706ee046dda2b0b25e4d2f392c067ee01893ebd0a8e07d642aa2 |
Close
Hashes for coredis-4.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bf99cd203e442fef967691637d26e0811dbf4a972cefb94cc4f0752686a4f47 |
|
MD5 | 8455a2792f34c7af43b670eb06e1ece5 |
|
BLAKE2b-256 | 3d3a4513aeba3d743deb312db9e309d5f267f6488529c34031bf092debcd519d |
Close
Hashes for coredis-4.5.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f34dc78ddc905515f727104b71317d243aa97d170914a6f8247f027e26783768 |
|
MD5 | 5abf3dabbb040b35a0c480f4202b50de |
|
BLAKE2b-256 | 96dcf7e858c090e6d69f854dca5f4c6c1ea6dc5e0961844d733eead327ce81e7 |
Close
Hashes for coredis-4.5.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3901933b14bcb529efbc9fb2ae93ceaafdc6c39b647c92efa0055d4ddfb2a3f5 |
|
MD5 | 8b704f9f09ad7dc6875dca4db4e1c765 |
|
BLAKE2b-256 | ec13084d02a0f96c94ae75227cf311c98b59e64f134e9fefc541c2793c56c636 |
Close
Hashes for coredis-4.5.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d371fa5aca79938f81308376d52bff9acae14bb2bca1e84f3cefd3b71298cbb |
|
MD5 | ec583045ba677839a8a1711674aa7f72 |
|
BLAKE2b-256 | ad5fee1d0990b72d96aeedd5becb83fe60ddec6be90bceb0520a7efbec879462 |
Close
Hashes for coredis-4.5.4-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fe172a33239ebc89d284dda58f3e35aeb4b16b4a88a8b43b6fbf1320fedab14 |
|
MD5 | f06449b8b0407949e32720364f48d5eb |
|
BLAKE2b-256 | f9ebaf087f8f915853d00d236f9c3bd331f9b261056edccaad1f947cd2a76fb1 |
Close
Hashes for coredis-4.5.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 614f42ebb9bb1993091169e80309c0e8ee2010eba828577d604c46d1d817b008 |
|
MD5 | f8d4cdd59175c49eb5f639a511858089 |
|
BLAKE2b-256 | dfb174aded80ea22419d2cfca8e91e15536c6ddd7940a91d7c6c5ca7f9f15665 |
Close
Hashes for coredis-4.5.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfe6cb3bfc726061aeba59970e83b417a94692ca30aab86b2025c09c504e3b85 |
|
MD5 | 87dcd4dac5794934aced97daaca23dd9 |
|
BLAKE2b-256 | 088eeaa45bc24c2434ade70cdd6de53ba755f5c48448db0814d3da96a1d16a10 |
Close
Hashes for coredis-4.5.4-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddc7be2cdbb40960ff333113d7f3a19355ccfc2cca146f824d597027cd70b025 |
|
MD5 | 5fb4848bc04670a1f401519d0840e41d |
|
BLAKE2b-256 | 6484576044971e95155ecfd6e8387df0f8796bf82b48f9dd59077cae9af9f5ac |
Close
Hashes for coredis-4.5.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79eb767a8e6bf0beb914ccc09e5b19b947ea77d2fe10c47d2a1639bdf087aa84 |
|
MD5 | 7b32b26b5ff4d209c6791d1020da2ae9 |
|
BLAKE2b-256 | 3ad3b7828db4c7f7c30c17ef049c25b5162f0a0d29011beaa44e1a850cf2be1a |
Close
Hashes for coredis-4.5.4-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c552154a29a9e1e0ce8417a2d11ea2b8142432354472d9817db8647430d20ac7 |
|
MD5 | 9c1b5b81700e68f6df23bf4103097100 |
|
BLAKE2b-256 | bda2d981c26349856de25554522a3e8b2651ccd7a60ad1c1b07bf125d89744bc |
Close
Hashes for coredis-4.5.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98669afb3a7e99641fe3de63994d2f2cbe77b55f6e57fe7a87e1d75ec952fbca |
|
MD5 | a5e8cd28d3b6e9e4919316758864ee26 |
|
BLAKE2b-256 | b0982d0df55566f987d4fdf9ae5c77bf79deb23e8236f992e624c6abdd03a6e2 |
Close
Hashes for coredis-4.5.4-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05506a018c8472250f89f5a62be647f304f5514b32251170dc0337b7f51912c4 |
|
MD5 | 0eef5a6a7a6674659c15b0bccaba0c3b |
|
BLAKE2b-256 | f103de13a318ba7c318598580d83eb2c3aba799e443136c67a6c2b553cec74df |
Close
Hashes for coredis-4.5.4-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc4ad54a1bdb57527f224700802a08e9ea7f30c645dafd69b27880c0d9d5e2ac |
|
MD5 | 02ef664f06629739c5f26dc7205c7506 |
|
BLAKE2b-256 | d8b1fcda04125230eae3addae2e489cc55d80a842c6681463bee85272d20c6ce |