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
Experimental Backends
coredis has experimental support for the following redis compatible backends:
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.0b2.tar.gz
(181.1 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.0.0b2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7ec4b42d24c4360988a937183bb7cf4e10b248c26d33e39771a17cc74a5a4aa |
|
MD5 | a4b9f0d4654a2a189e50383293c67739 |
|
BLAKE2b-256 | 0e5fc9ba0535132b61fe9bd6c6aacf61f771d75123d31e42dad00d0c59289c4c |
Close
Hashes for coredis-4.0.0b2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c4b9be1902bba51b354a51366fb1f8ac6aaaa8baedfe4004a9eafe4c3b3be7c |
|
MD5 | 8deddee4f2d3439fa31a51508f9cadff |
|
BLAKE2b-256 | 6a2ecafd516c727fd88f46c1c27dd59c9f0df51dbf42d03391d39cab2d9cea46 |
Close
Hashes for coredis-4.0.0b2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29ab7f2ec78c881031a131a48bebc43df9e1d1364d6f68a290b4bc19d00afd3b |
|
MD5 | 3cbe96e8b371bfb1925d677a32ee6fa2 |
|
BLAKE2b-256 | 64bb5c8d38918f6304b2c4828bac7f88cc01aa5747eaa8470eff701e3d140c28 |
Close
Hashes for coredis-4.0.0b2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 046e819defde9240089af2a72853ad1682fdc9a9d1e5af962217a2a1681a66b7 |
|
MD5 | 06ebae50799c1610c2cffef8a5122a75 |
|
BLAKE2b-256 | 84283b6f621d884d8434e9c862b41a2c101a3fdab5ed4b629e55ea556c8cab7c |
Close
Hashes for coredis-4.0.0b2-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21b2ff1dd28d7bf1b29155e92d5da4f176c8332137e65d74cfcb3b044228f195 |
|
MD5 | cc67aaed33468b28b54a7e444fa0a5de |
|
BLAKE2b-256 | 7e39f24a715c607665f42403902b4edbf7cad99ef9d790cab316276686f5efca |
Close
Hashes for coredis-4.0.0b2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30f5147896dbabb3a2960833086a6ff4c7b94130f5dce476da80be98b197b6af |
|
MD5 | a909049632832e779f93634d7ba378ef |
|
BLAKE2b-256 | 18cfa6206a77b1871e4b1b81cccde8642b17a183a1dcde11b2b2d026fbd57b38 |
Close
Hashes for coredis-4.0.0b2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 713c61d0c718bafce86b412e18944860e88a3d45262c34ecf005cfa7944da31f |
|
MD5 | 877374add25d95d33affc64997d688d9 |
|
BLAKE2b-256 | 6c58904212f9eaabbc4cf1191e8e298367adfeb272442197ca4e788e2119333e |
Close
Hashes for coredis-4.0.0b2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edae2b18fc8425d5c8814603bebf8dd587021b6218bf29c0759d8579d8ae4203 |
|
MD5 | 148095bd6e279242b0fe625321afbf6a |
|
BLAKE2b-256 | 4aadb969e1716cfe57bfca1f0f792d420d0ee70f1fd5756a87b7292aa6e375b2 |
Close
Hashes for coredis-4.0.0b2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25a6209e45dd87b62365b63ce38f80517fe51bf4545cf8e26863cb5cf8dd4e1b |
|
MD5 | 17d50a118f08696765d58d5394c0bd6f |
|
BLAKE2b-256 | c858e051142b67311e29ba0f336eb75105d6ab2d4aeacecc72396a69ff74ce29 |
Close
Hashes for coredis-4.0.0b2-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca4e4d4f5882d7b3bba6cc0493738e9d030503e749829c2de159f89445e925cf |
|
MD5 | 6c3be2ce4218fb22f77d10164e5700da |
|
BLAKE2b-256 | 91e48f78d1da19ddfccf52ee609ab6aece1ff6fac2c4e682f7b2d1b4ccb4fd78 |
Close
Hashes for coredis-4.0.0b2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71f160fa581d225e148f2d9bcc1702667a8cbc5ee225d7680e28763c9b990f42 |
|
MD5 | dfe9876b696481c974614c3ac46886c3 |
|
BLAKE2b-256 | 7ea76b36bea90803fc38f0c161408a035a6c64c1a81e1c8f178dcb6de9b46bf8 |
Close
Hashes for coredis-4.0.0b2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b82ec685374ab153afd412adea93c429f0f3ad11cb86964c5095cb983632a08 |
|
MD5 | 6fe271191ff65741ec28fbcf75894fad |
|
BLAKE2b-256 | b463d2c24bbee6c5035f3b32d5e9f6734d482afe7990eb65ed5b688f2c5783a2 |
Close
Hashes for coredis-4.0.0b2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 759dd48286696c1aab41767f7a546f474334066a409d422596c304f352f41196 |
|
MD5 | 3040fe1a0f7bffc975ad51c73b575c38 |
|
BLAKE2b-256 | 6cb33d16edef5ab62131556dd53d8371cffbebf145328e3c830fc4e25b10612c |
Close
Hashes for coredis-4.0.0b2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 301e0fece5d7fbb4c48507be2637e3f047deecb1f44340aaa3a9f4bbac25a8d4 |
|
MD5 | fb6efbe7ea1dc5aad8e3fdc61c2990d5 |
|
BLAKE2b-256 | dd4dd0d075cde42f2f07abf69dce39a80c1f1ffe990f6a7b72a616f868e2066f |
Close
Hashes for coredis-4.0.0b2-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f50d65c0648594960d3b047df158d40084c3363e3de28e9de7e700ce3e6d000c |
|
MD5 | e1c28d5027ff073c799907623a7408ee |
|
BLAKE2b-256 | ffba07162347d40a1348567cd3a8a32f89d0f927bda00e1704f730d309fce4a0 |