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.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.3.1.tar.gz
(186.8 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1bb840e3645d400b67c91422cfe15fb50367a98714fa335260bf1a463c07d10 |
|
MD5 | 382a0d6cc54ee4632ceaf362a3a7b810 |
|
BLAKE2b-256 | da8619330ed8293cfae83bede4e560f84f4a37389c00700bf4fd38464f400e64 |
Close
Hashes for coredis-4.3.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00dd65ccbad1e08378103b9f8b1c6e94d1dec3cbbd83e307e215f6ba5548fc06 |
|
MD5 | c4fda1d2d40838d56883c06edef3275d |
|
BLAKE2b-256 | fb8da48e73dced977a0a8e563c5746198970943ec74d42ff25b4102edb507e12 |
Close
Hashes for coredis-4.3.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aa8378b1394b8ae6a5dd9e90b717c8e1ffc54bb6b18650d1f01081697504f75 |
|
MD5 | 9298b56cd4775c68b73c1a63ddf84d0d |
|
BLAKE2b-256 | ef0c2aa5f6dfc4f5251e275239b998a102b2fec263080fc434d0092ffa021eeb |
Close
Hashes for coredis-4.3.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 257adb355dc0b9e9700372c91359b008da81e9cc2bfb1cf734a0895360b25ee4 |
|
MD5 | f212649a01597f5557a1d8847232bde7 |
|
BLAKE2b-256 | 7bf074600290b7035ad6591fc4185dccda06ce03ce8a09b39bb70bec68a60dfa |
Close
Hashes for coredis-4.3.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfa80989e7135e79a2c1a342267864d3f66ff2d8f1b5644089defb0e254ac92e |
|
MD5 | ddb33e45813dedfad140728aa8bfa343 |
|
BLAKE2b-256 | 1a75e13729bee597d5a4572d3a2960cff818b9c3f429678e7524e05b184fd551 |
Close
Hashes for coredis-4.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e5a029f5818a34b05197595f24da3aa3189fe9148f4c7d30f218ff13634ff08 |
|
MD5 | 40d7bcbe1c6262b554f4101b537fed07 |
|
BLAKE2b-256 | c62ab3abb470534b28194902fbf3f0dd5057ad9ae8a3292b22cc91aff55f946f |
Close
Hashes for coredis-4.3.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8118dedbe2057bb67277c504b67551761f27b85ba6171f1e4fc3603a0a2bfa61 |
|
MD5 | 0cee0b233421859dc5cf146d435b3d64 |
|
BLAKE2b-256 | a2bc17a8d12f0fc41eb8807be8021de0ac8f520fcea4eaefe6dec46e68bf77c3 |
Close
Hashes for coredis-4.3.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22bdb488b97623b3aa4a8747532cdb0bc8c54d28d6255588b3ee4da6f8325147 |
|
MD5 | cf3387a7bdf9e9b2d3be4513ac88519b |
|
BLAKE2b-256 | 60263c23656d2320934a1eedb70905a505e589af199eb8304f6e93aa5fa39b4d |
Close
Hashes for coredis-4.3.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a26c5c699310ee0f2d3ea80876f351c7932df013d31f8ecd99193b296eba3840 |
|
MD5 | c7a99e3a8c78212f2d4e412ec72f33bb |
|
BLAKE2b-256 | 215cecc16e45b6bb772b690b30cd479177684b436913154b36af67f04ab9f949 |
Close
Hashes for coredis-4.3.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87dba24aa54d9c18d42e2d5c5ecd2700a0f96b2c1627ae90634e46d2a254db3e |
|
MD5 | e137215f9d74bde329f71d35a5e3f278 |
|
BLAKE2b-256 | 774c22ec92c9be90cdfcbcf3082a34f92ba15e03bfc69c3124590033c097236e |
Close
Hashes for coredis-4.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef45354dec5609e22d45a9cfa5f0b7e4b2d5980fd59577d564f17b3a3a079975 |
|
MD5 | 246cc83214f14c78ca3981d86bf6f3f5 |
|
BLAKE2b-256 | d3b41170d4363d6fb269896525d7c07891a4943883276406d2b0b56f9c9c569b |
Close
Hashes for coredis-4.3.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ee753e3423181857cab08c0199909eb61c225afe8427fadd2b1bb3a6d3b86bd |
|
MD5 | 46d5602e9d1630ded3897eefab810519 |
|
BLAKE2b-256 | 047050780587295c9e821a1f5e13a3102b244e8ba429dbde18bb24edc74822fc |
Close
Hashes for coredis-4.3.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be5e92859f7db33f2d2a0e6157f6786bc015b44c0a45fc3934f369e68ca09c71 |
|
MD5 | ef17956c6282731f34e107dd8f705e0c |
|
BLAKE2b-256 | 1b3731f5f29258e211a3a680a3e2efd46360dd03847ff685e6ac0635b0082fc9 |
Close
Hashes for coredis-4.3.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5a3620b4a24fb3e7088faca0adaf694a98139a1bf8c5d126f5170af9060037a |
|
MD5 | 205e0a0dc73e171078ab011a0a6c2751 |
|
BLAKE2b-256 | 01251683c0844a24712fab2920a07f3673a711b1ee13cce5c7d42de827c4124e |
Close
Hashes for coredis-4.3.1-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5055146853184f9b06baa2a39e7e7dc8042451689fcdaeaca2ec090927ee46a |
|
MD5 | f9781a521883e9daf227c1ec7b61c6f4 |
|
BLAKE2b-256 | 969c760170aa6072e367960e56b025a2dce96adb377304e71f1491a316bdc08c |