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.0.tar.gz
(181.1 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d255c77993291d275180cfeec210d4aac2af2857938c6365d97d697ea1b5e3af |
|
MD5 | ff6ce50706982a6939675b133699b978 |
|
BLAKE2b-256 | 1286bef04b5e1e4505d90d359db6c0be6242b180ee661558ebcc64898f9ed298 |
Close
Hashes for coredis-4.0.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cf3f0353ca0b5f40dc7911515fb99454110d7f2d485a5224b3790752e9e2633 |
|
MD5 | 670b1ee199d1685266739096a8e1f85a |
|
BLAKE2b-256 | 21209f09872e49420763134e5111f0b9165fb8c8058c6e9e9c3d07fe077a12f1 |
Close
Hashes for coredis-4.0.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7545a1b714dcb11d8743b759894574c797720b0e90af3d35aaa8d367d3f71a8d |
|
MD5 | 74cbe396cb50dcf1e61a12eefccb6702 |
|
BLAKE2b-256 | 20fb2d77069f6cdf24bdb8f7c5891605ed236d22648dba4b9b3a49a4d03a8bdd |
Close
Hashes for coredis-4.0.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1d95eb84d750ea2bf038858b257a680fc0721b5de8609c2605b6dd120102764 |
|
MD5 | 5f3b4892cc8753ab6447e905f68d7dfb |
|
BLAKE2b-256 | 516de218af6ef7f005190cfdb6b53e15aa3116055adec3c6957ce0e58b69cf32 |
Close
Hashes for coredis-4.0.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e61c51bf83690bfed4a474270a08bd0a48a08beef37e8bd4bcf08d1a1b270538 |
|
MD5 | cbbe38b197a6ab593a6e07efd470fe32 |
|
BLAKE2b-256 | c9085b8014aa14c9c2ecef8d4fee31576c70d7d50ed51774aedf1fa2582dc155 |
Close
Hashes for coredis-4.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fd46bfb911883c32c62661a6a667bae47cb5ffd98d156c88729e2737c6d54dc |
|
MD5 | d326ff741d3e39b6c2c8d5d2572bd132 |
|
BLAKE2b-256 | ead8c84565f6a61682d1e347c351c2cd612bacf135e88ccd54e4e061ebf85a5f |
Close
Hashes for coredis-4.0.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9424d2a29a2f50191099a358b4f060efacb72588022e113d65d6d7be179e97b6 |
|
MD5 | c9a59245a291f137ca74606f6eed2285 |
|
BLAKE2b-256 | f32963a8bd32543396e6700c3c347643dbe5598f588da5648c452242c472f6ed |
Close
Hashes for coredis-4.0.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74bb766e378e323de73383f8280cc7908ed85ff6e52f76d2bff3501313907ba7 |
|
MD5 | 082dc380505d85ef01cfb0976f6e74ad |
|
BLAKE2b-256 | 96ea9ccb00d396a0fe1afee39e260ac2ba48f07c4be03945f83cba15c8fc9006 |
Close
Hashes for coredis-4.0.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cba9a7507611e0b120fd72ff4e1b8ea5565e24d5c1ffd6bfc291260ec9a459d |
|
MD5 | 6175372d0bda939ba2ad8fe8324e74ac |
|
BLAKE2b-256 | 3d8f6a8c49d4f339f251e129b155fda840b9e61feb72fe92d94fba9e862e1af0 |
Close
Hashes for coredis-4.0.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 177e983c4651e86a485548b583d432eeb1e7bf269829b2109a6750134749eb1e |
|
MD5 | 4e6d5eaea348163eab8b163da1bbf0a3 |
|
BLAKE2b-256 | 8e72be50a979f397626c88519f067aebc10544d3e8eb3d1a5edf11a75d25e4a7 |
Close
Hashes for coredis-4.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa8ee28035b3ff077de34469cbebbd8c098f512834726ec631f613a67c6509c3 |
|
MD5 | c6c5654f1e97130ebe6d7654d9643ef2 |
|
BLAKE2b-256 | fb46063b6b16f3a0091b32f97e8d0bbe44f3bc43bd9143b8dd10f5ae0fb343fd |
Close
Hashes for coredis-4.0.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37e844d61f1d262f19ab3575ee2a257a46bd451454abdf2df142353035dda6c6 |
|
MD5 | 65382478a52127d81f9767255a3a00f8 |
|
BLAKE2b-256 | d132f35d1e4a5332248bd14dfcb9c49a72b6c73593ca730a5994688fd3551366 |
Close
Hashes for coredis-4.0.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2a44c4e36df2a041e246be01686150f2cfdba4a311f865eb476ba5901986b9b |
|
MD5 | 1b2677720da15045ba62163b015e3a1d |
|
BLAKE2b-256 | 97b74126d3907f35c5f77b361862c1185908dc709c83c21d3e0cfc9dabae92ed |
Close
Hashes for coredis-4.0.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2bb267b0482d70d01716c20534b9a2f8f5acc6e29d12510573b36af1d6d3d23 |
|
MD5 | d4fe66d0b0af746516f180c5df62991a |
|
BLAKE2b-256 | 40be43e7b9355758951b0747815ad8d135ece51bc385c746f6260dc0f17059bb |
Close
Hashes for coredis-4.0.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7197648c1e15c7e9c33e903051ab698e3a75c251310a8928a96d7f91ca5797e4 |
|
MD5 | f5a81e366989c79c20c1c4afae8d722c |
|
BLAKE2b-256 | d4497dd2ceaf10e153b272dece8fe2da19893e86a826556436eb9bd6d889c172 |