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.4.0.tar.gz
(187.2 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92c17178cc9c9b304b9d28be14ffd3192763227f0dbd7f2702a0a47c5c3e7330 |
|
MD5 | b9d7f4e14c651d00e3e0dfe2a9e48ed1 |
|
BLAKE2b-256 | 2da70c591479d7502d93c5b6681a828c32248e637bdc08e1adcbfea312d85967 |
Close
Hashes for coredis-4.4.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35592edb66c3daca6abf1283afe71588bf3737065dd60f06d47488bf3e74a014 |
|
MD5 | 3ef90058eeb549405b1258be7db5e242 |
|
BLAKE2b-256 | 9b6799b5f5ac9e579942a243377a6b8a1df70292ebe2db526a9212a4c96d60b8 |
Close
Hashes for coredis-4.4.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16e9993e12697f995ef4a74169445d4f6581a42d6535877782caa984abbd92b3 |
|
MD5 | bad9a6af9c9000aa54d084e946efdfa7 |
|
BLAKE2b-256 | 0a2a48a639146dba2beccc14068bef72502bd85cf2e525ce8963ad597f375455 |
Close
Hashes for coredis-4.4.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c23b33db6b9460ada9494f85cc01c9862345e61c3a33d571de8c541c09f32f0 |
|
MD5 | a4277ccba55351751d568ae108fca8b7 |
|
BLAKE2b-256 | b53a61e69ed3901f65c47301fac51cb7958e494ba7f6236c3d9b87f949612e91 |
Close
Hashes for coredis-4.4.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93b0ba49ad7094cb3cf210c1e31b2e0d2e658ae697aa2b57d9b7b27419aacb06 |
|
MD5 | 833c9c684b126bbd930312cbe04cae00 |
|
BLAKE2b-256 | f36e3cbfeae6e29249aa8f8c415149ddc8464bdfa52398efef52043b1d8450b3 |
Close
Hashes for coredis-4.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 559332e0951ef836e3a777d02b6a0e66f25761764ed74765e2bf0fcab7b0e2d9 |
|
MD5 | 6db5486fea1baa87c90420278dad28dd |
|
BLAKE2b-256 | 939a8d0a2c35371d58280d3c69b596ee8f0ee76824cf121953f6fe5236b4c8b5 |
Close
Hashes for coredis-4.4.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e6dfceca433e5530ca33018272feeef5921ff578c5075b877ed8e3fbddd9176 |
|
MD5 | 077deeebf0542c3dd1238b79ac71c8f4 |
|
BLAKE2b-256 | 0aab2b8ad49dafc86ec969eac4d98c9afa4483d06f2ca656a8f160206341b5b6 |
Close
Hashes for coredis-4.4.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96e5fcd4f63f5fb66c4537cc08829ac44691b3d49cd0b9eec91d746f4bf423dd |
|
MD5 | 860d1344d298050cca20023b3691fe46 |
|
BLAKE2b-256 | 33209d0ac15500997df3a972ee9d07332b08db2edbf2c1360805e8ad3daf16bc |
Close
Hashes for coredis-4.4.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a227dedf2986cb85ddb21245572e79206c55fee6c7cff3442d3073144de238c8 |
|
MD5 | 764381e4aa0ec06d9de3e49cb4fb0496 |
|
BLAKE2b-256 | 6fba5583b7c4b83a2ce688446dcf81d1993be20f3eb31a9b7638f0a220ba0144 |
Close
Hashes for coredis-4.4.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cf0ef2fab3771a5e6188e09bd5c9a18c4c80996ae01bd0a9c72911de870c405 |
|
MD5 | 4e07c3baac9abfda7a76d25af0fbba7c |
|
BLAKE2b-256 | 20f360ffcf240affe69e3e1b7714bd7eb5749f7d7e778008ee8bd788bab17f31 |
Close
Hashes for coredis-4.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 624d38cec60274eb64963fe65f7cf80463efbfc17b1a10a24d08019421ecbddc |
|
MD5 | 11b09f58c06d90cb8e6acdd87ce9d30a |
|
BLAKE2b-256 | 18a4479ce32707962255ddafc92e521a2435b150e3bcca2edb9222539626835f |
Close
Hashes for coredis-4.4.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3f3748eb4698f7898b603ddb2e873ef7d798430e21c94a061417c74003c0fc9 |
|
MD5 | b3b55a51f27049098dd4746ac4d4c306 |
|
BLAKE2b-256 | be8fbbc961358daf16e91496f4a0639aab0c9e1c9522cb75cf91d9c459ad086e |
Close
Hashes for coredis-4.4.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e67798b157e627b938c7d6c1bad955ff6cce035f65a6a2553e160f2963f6369e |
|
MD5 | 99d01381a82b1d5217aaea82f9b5c1f8 |
|
BLAKE2b-256 | 70581436f8312cf7ec7644aff36114aa551bd6c3f628d861c436b8c4034f6375 |
Close
Hashes for coredis-4.4.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0938f5dfd8bff808163099f3430a40b076c14285db06284935c1a17f82fd246a |
|
MD5 | 67d561945732d55830b63c59ac97e872 |
|
BLAKE2b-256 | 9f8de9f0633c32f81613d360272063ef088422bbd0317d48142ac615e75513b2 |
Close
Hashes for coredis-4.4.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb66dfcabc1678dc5f62729270563010746b7df4e8aff70a65fd04b4718b23a2 |
|
MD5 | a5c8513ee9abf5a8a74ceead4a77a572 |
|
BLAKE2b-256 | 46a8ab5cf21b53b73487916e5c00b9c68b456b008e70332519239712feab1477 |