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.3.tar.gz
(188.1 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6b906b6a29edf8b464d65d485e8a43abe1911937feba74e228e0b21f7bad7ed |
|
MD5 | be802124ad4af87836142e2723ee1789 |
|
BLAKE2b-256 | 1cb0ea39df9c751f0243718fe694f55ccef2ed64970ddf055f368b7e885e6b21 |
Close
Hashes for coredis-4.5.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aee1d53de93e1fd0af60147c792c915fd9d45efe5baea542a1cc2af50e76c0d0 |
|
MD5 | 1508a6e9f0d74434019c6cbfe0ce9fd3 |
|
BLAKE2b-256 | 2347f060191deca94c228e86e6a8d799f0ff83f2c4ff01caef66dd043ebbe8d5 |
Close
Hashes for coredis-4.5.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 360feb800c56be848b1cf0efed05c9d5c43922cffa54329418f24ae6ebd72e16 |
|
MD5 | fff9c549a1f0dadef3f2dab30b9b6513 |
|
BLAKE2b-256 | 1f53436dc31e7aed8bf3bc14411c6d90e75f17a20e4e5a2287738f99055a34eb |
Close
Hashes for coredis-4.5.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 311b4c0d35faf940c776a9e857306c4986dc39b22594f24480cc66ecb6274f33 |
|
MD5 | 7bcb0f0ec8ab50460a1725ff88ee4464 |
|
BLAKE2b-256 | ee6f0c261e2126fa05f3caeefec317df9960fedf55f025f53d94a2faacfdfbf9 |
Close
Hashes for coredis-4.5.3-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df77e3c42b47f7762e551ce012a9e6f648407aaf1f379f2c31495c1072f34e6b |
|
MD5 | b0f1f1c6d26d581e342bb5fdc6591d50 |
|
BLAKE2b-256 | becad7725cf7dcd5987bfc32fdf9d3262c66f0d3fcb227e325f2bf313f9c704b |
Close
Hashes for coredis-4.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65c794e5e88687c8e1104131aed66855e6a3b00a849e51937e4d5ac96150da4d |
|
MD5 | 704d1eb61838b31c0e26b3510c5f4b19 |
|
BLAKE2b-256 | f71476721722ec840509c47d1f6eeaa8998873a86b5eb2c6135ebe23708c222a |
Close
Hashes for coredis-4.5.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd58791f835304c1a688646ce10c02197b12d596e7c858f9fed0efb3aea67c20 |
|
MD5 | b432eb9a6a9bf2a014333c79f4bf6f42 |
|
BLAKE2b-256 | 88f5253e89c9f9483497b92dc93691ed04d07532e4e1982248c1ccc697d804f3 |
Close
Hashes for coredis-4.5.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a00e06262973d8b9a3fce22664d4b0b0bf00b274a0d9d6e88222dd6edea066e |
|
MD5 | f7cb2e686fa806ca21fe834775d15028 |
|
BLAKE2b-256 | 94c2d1835112efbfacf2e95c14394ce06b779337061556cc6932cf87208d8a1a |
Close
Hashes for coredis-4.5.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f486a21cabf0dfaf3f4a1d7c931db87cdfa04ac4320a960c26f7bb388c7f12b |
|
MD5 | 3d78fcb9fd3d58ee6758380496740bcb |
|
BLAKE2b-256 | f76a73fa9d5b495cd3cdb97fa614aa7487452463b8de9d8b0df627f4a0528512 |
Close
Hashes for coredis-4.5.3-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c95d6c8f7b6538b72f976653d193c10fbfd2fa7311d39516a6497faf5c5d7971 |
|
MD5 | 8eee88f211b607de3393b9064a714ac9 |
|
BLAKE2b-256 | b41b88e70f213ce1fcc3b76b9d4be2bbc4737b0312112990a9f50401df14726f |
Close
Hashes for coredis-4.5.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed56939cd0f347bba6e163431be30150699baf4b30db97fe95e89ea612434caa |
|
MD5 | fb69f2890f4f933de112677c41258c2a |
|
BLAKE2b-256 | 8e6e0f0603bb8cdeceac6fbc112104d08670f24ae232404f1dc3363596e0d917 |
Close
Hashes for coredis-4.5.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb3b43a6ef5feb440ccdf6897b5866f5e9029a3b2a803409542282466b2840ff |
|
MD5 | 21224d782df2f3f163fd4431615694f3 |
|
BLAKE2b-256 | 4b7fa87a546231eced80b83cdf524a487489fca6254c389ad7a5d3a01ce8c37d |
Close
Hashes for coredis-4.5.3-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68ceac205a4471c32f9a61c63d2d7d8b301ba557778f6a1302e2506d80baacd5 |
|
MD5 | bacc974446906b8ed9bc72498052d84e |
|
BLAKE2b-256 | 77877be17237c864df26fa21b4416f308dd8ac57f8c8370114c4ccb7f55f6e91 |
Close
Hashes for coredis-4.5.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd10e2bdd42a80e2267268e4e9ea5321ec02a86abf43349b6651bdde604ad8da |
|
MD5 | a8b7d7ab5a2ff73f5c7a4d0486b8f716 |
|
BLAKE2b-256 | c0d344933ec5de518ec32369cfea66b9ef0e7859906e32d87a3de42d1027da5e |
Close
Hashes for coredis-4.5.3-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6838ac8eb692dcb2cb94faa10ece7571b85954b557620064d6501228847bc2a2 |
|
MD5 | d6af3af43866d7a08b6c498ee5f9d0ce |
|
BLAKE2b-256 | 00f1350862ce0905159488d047ee4fcfcaaf709636a8584ddc46164e307090a9 |
Close
Hashes for coredis-4.5.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b1c913c6597dab40dd1c5be4bfa430eb2cf0c88cc98d76165bc456af26a52af |
|
MD5 | d6518353e8d722ac5b35ad3ee25636ca |
|
BLAKE2b-256 | 980c8a96909a137107c5476f89d1c298512f69647cbe7f3fc199e666f74ca726 |
Close
Hashes for coredis-4.5.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77f501d6db555cdebfc5f7d257c323598a1b7c093f2d2bd8ed170d6430a228a8 |
|
MD5 | e16f9e92a58ad23220a348f4f9999792 |
|
BLAKE2b-256 | d020d9e599e126157c366fc41d0d3e7a3f2c8a7b375c6bdb36da5f7fac40b1ac |
Close
Hashes for coredis-4.5.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7e2001ea269dc08dfc6949d7e74162364ccbf349c543e9dafd138348a891a2b |
|
MD5 | 51d578bd91cf659c9bdb6bb21341e669 |
|
BLAKE2b-256 | feacd6191b4a7fc63ce88e628eea6ae20c4fb839e6ae9be51a2299d176b9818b |