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.1.1.tar.gz
(184.5 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1224605a27e574d6e4b4c31ec3f7686b4c12a121da68bbbb4d200912a30a140a |
|
MD5 | 4a48f7a42028832768e3402057e5e257 |
|
BLAKE2b-256 | 61bccfd8772729c1f6287db2a6a50898dee6f6a5b39ba1c4668f303781367398 |
Close
Hashes for coredis-4.1.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 872adb192c0adb3a20061ecf74fd414b96b1d3f6a3204ef54a078b1f8a0c244a |
|
MD5 | 9f0340c0daa0c9f32d05f3ad7692aac6 |
|
BLAKE2b-256 | 88a4caee1c3fe55749746e381d8147a089530849735fcdf116dbbbfd7803d8a8 |
Close
Hashes for coredis-4.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e14022b1f44a3421d85f016ff3fe9a35d397cf3b59200e844b7f6130f6a2481e |
|
MD5 | ff0d0d208f3d17818ae1916f07a95b1a |
|
BLAKE2b-256 | de74eb46ac2527d228a91d4c7e57317436702928304bb423e3fad0f7d6829852 |
Close
Hashes for coredis-4.1.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cec1c28ad5f4cc981f55fd3aaec6424fcff9ba67e8ff777b218ecc43af0bdf55 |
|
MD5 | aa73b87b91f77055328ea8437b18b805 |
|
BLAKE2b-256 | ce73eb57acefac3c45c2fe62a7da9f2ac03d50bbbc923e7d86ec2a541ebdd34e |
Close
Hashes for coredis-4.1.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bd1ff5f8c562918c1d662064b3f5344121e181bfba9f27441cd339d33304c2c |
|
MD5 | c35dfc419891900ffe0278147dcfd34e |
|
BLAKE2b-256 | 817044327ef7045643aa6b03f8cb9e2d6f52db38d2cfa935267bddf2aca5848e |
Close
Hashes for coredis-4.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15566e24bc94a32c3b240ec404593b0be9276d03b5322a4d657a2b610ab891f9 |
|
MD5 | 70e50b135aa5a81df8c2fc7cd89a41a5 |
|
BLAKE2b-256 | 03a70128b417c56f42fdbeb0142ad0357c52937449ad644f256dee01310f55ad |
Close
Hashes for coredis-4.1.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5891e958e71d6fcd1579956c455dd7888514a16bc0d582d1e0bc9af910dc29bd |
|
MD5 | eea9fe4587a7374236cfca28bc459476 |
|
BLAKE2b-256 | 3e7ae8897f473168024a2e1ce486028a27612c8f4637781b6fe7dc809c56f201 |
Close
Hashes for coredis-4.1.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d18111083822baf80198b1d8ebf2656b7a7d4433caec31a17f17fafdf91af94 |
|
MD5 | 26754351c9c6dcf28b902a74d5da9540 |
|
BLAKE2b-256 | 452cc48953b8882d87e2c129eea14d99b043a283df565496dfbe4ffc1c470f97 |
Close
Hashes for coredis-4.1.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3915fbb225354c7c92c40765dc49b62861a87b8855c54960c68adef7ab4ac9b5 |
|
MD5 | df203960b7cbeb921f8e4c9612960a75 |
|
BLAKE2b-256 | c755682ddaef7ea9ec53922a97254ef8e5689b17701f4d69fe0c471c02e3def6 |
Close
Hashes for coredis-4.1.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fdcec77259f62cf8b29b1ca3b676d07ddc539a3d7834e00906291c4b7605d95 |
|
MD5 | 551b4de618f4ebaf0363828655e70ea0 |
|
BLAKE2b-256 | ecc87cbdd7efbaa56452ce0a5033dc02b08d2a19340752f7dc38df3a0d8f0478 |
Close
Hashes for coredis-4.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01dbd106fb76205f539637fe725a824a631ba317b5e16303055be05e77845e83 |
|
MD5 | 2b7fed605ec42a7bb4e0174a22276362 |
|
BLAKE2b-256 | fae6f56e92ee6e3ab37079f8fd34fab6e6a5b7b055292709a0e59266ea9f1d5e |
Close
Hashes for coredis-4.1.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 203170916b0ff5207ce79467cf78426df235a93a4d51bd8f1e710dd90da42c53 |
|
MD5 | d6eaec18748eeab94de45bac03a386b3 |
|
BLAKE2b-256 | ff22bb95e0fb4796b1e016df27d1a61668e7c44d88b32cb20176d808922630a0 |
Close
Hashes for coredis-4.1.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dec40760fb7e44b5ad75d86f8f7d18da6f802cfcfaf28b67b8f0941da5678d3 |
|
MD5 | 98d579268dd2d16c49f2643cc1593331 |
|
BLAKE2b-256 | cf041122aa0887c11c8f9509d5b16d53f04dede18263a96137563387de5af4b4 |
Close
Hashes for coredis-4.1.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6242179e512d501d22939d80e46194f28539e44d6e7918c6361e8bbf8ab02ce |
|
MD5 | ef60aebc04c752760099e5d73c021eee |
|
BLAKE2b-256 | 7333f1948698d3501100569c32700913eecff69d026cb98082e190466b9df83e |
Close
Hashes for coredis-4.1.1-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40f8e9987a55d32da7eecd3589aacb30babe0e5a93e5ff8199ace9a1e00419de |
|
MD5 | 41d4a823ab74658ebc4152b3e591780c |
|
BLAKE2b-256 | 123bc3995e358674f5838b7fd7f9978a777af2d72bbdc5e1d13ae828bcb0e8b5 |