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
- 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.2.1.tar.gz
(185.3 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffc17632e4125c4fcb02dd7948d39246d02ea3e6200246e2cf731c8286dcddf5 |
|
MD5 | bc8200eab45da8200da3f2ff8351869f |
|
BLAKE2b-256 | 4966616a68d3a5fbaa04a79bf41998ace88e227263ac9a8748dd711ef1368c16 |
Close
Hashes for coredis-4.2.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cb5bf54c3119a5fdf1bfec8b8ecb768b98fe73fb0eb7f06464e8a9effbacd86 |
|
MD5 | 41ee47930264ee4a182f351383f64cf2 |
|
BLAKE2b-256 | 9c0cbaab76385f44a9bb839628fe2b52602dab68f3ce0537a0d4d932ca6b4b74 |
Close
Hashes for coredis-4.2.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b86f228957cc3dc65914bae90db3ec9356f62c08009fe00919ff682cfbb6bc01 |
|
MD5 | f8168561b8d5508f3b144278fecb0259 |
|
BLAKE2b-256 | 250973053d73667f2c4d824bc8d953db3463ec8c7fedbc1b63c6a341c0247a1c |
Close
Hashes for coredis-4.2.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 572e0d5d63cb5dee4e6529783adbfce6f43afc469e0ceb24ccec15f7f1a7bc94 |
|
MD5 | c68b0d6f55915c8030a9c206b945c2dd |
|
BLAKE2b-256 | 3120c1e53adb3c6f05b53181492e83203e32a6513e1175c681bed21801be178b |
Close
Hashes for coredis-4.2.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30d715a82c4b9334cfdf31d4e04bee0ae7f80c8e5dbdd585bb1ddad89fb086e5 |
|
MD5 | dad5fb354cb305fd1fcfd30cd1e36cd8 |
|
BLAKE2b-256 | 94f33a6d184a5d69cd8f2998a59f58c0a328f70f66b7b80a27be154a832cd73b |
Close
Hashes for coredis-4.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 697375fc65ab35f774e39bc4b0e84b06b5657175ed434916aa6afb50aa4048ee |
|
MD5 | 95239c3db3fdb96f16c07aa3ba2a34e7 |
|
BLAKE2b-256 | 780953d37a49c657afa464176aae48e2ca58feef32396e38c74752dc3ef2fbb0 |
Close
Hashes for coredis-4.2.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcb54bc40b590a8c40c476a6a122fe160cae729515f66848077025b689f38a70 |
|
MD5 | eca10d589bf96714192634fc389150c0 |
|
BLAKE2b-256 | dd552ed60bf0d5fad2191962adca1ac08456a3da05825fb1e4ed101bd39c04cb |
Close
Hashes for coredis-4.2.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f1503000e1c3b2e641ab2afb2ddc03e561bcffe103674fabf7e111d59323505 |
|
MD5 | 859394a832d556502f5fec149ea0c5f6 |
|
BLAKE2b-256 | df65ce2a8af15524d8ff2f20ddb0dcbddd9828f8595308eff336eab7037fe55f |
Close
Hashes for coredis-4.2.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a5d259a6b9c3b1423544bf10daf9c67a8505f00315adcc9d3162da7d6a9cee7 |
|
MD5 | 49aea2b26e0e922b5bd3915c86a9f397 |
|
BLAKE2b-256 | d6bb74e5b196057128718c2d2b89283a42d4fdfdd20d8d508b9073844b1a6aad |
Close
Hashes for coredis-4.2.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4134f98578c57f06777450ffe021835f5661acdcf4120e60193e8894c7fbd677 |
|
MD5 | d3533eada48f2e0c9a8ce61c4fb38a8e |
|
BLAKE2b-256 | 1d4d6980d55e0a2aa16e76159a7bdfb5d4150b469b3f0e13b8f54bbea1a123b8 |
Close
Hashes for coredis-4.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 745f97014e99035fbe634635ff31f7ca7455abbd5f34b9b1e926510664e0df80 |
|
MD5 | ace3bf8c20c648b23665a32aca9529c3 |
|
BLAKE2b-256 | abdb1829cfcfda1d555b98fa54d1796c357264188b3e7bbe4b8d2f31f99bfe6f |
Close
Hashes for coredis-4.2.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ae118ea0a70ea94349a64f13180e4b3e54782023bc567370fa74473aee1251c |
|
MD5 | f3a806fb6cbcbf43d3d64c0cd2b3c46a |
|
BLAKE2b-256 | 384f48c0fa2694562bf54473083ba90aac8b0c25b4d4765fd1d737dfce9cd0f1 |
Close
Hashes for coredis-4.2.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68ece688738484ad2b0e24ee4454ee298301b368c0d31c5de9fa19ffdd92c0d6 |
|
MD5 | 0dcda9f57f143777eb935b8c73dc785a |
|
BLAKE2b-256 | 3530767d27612d6d689a2901696634abab63df8f85ff6e4d9f81784e91a538b0 |
Close
Hashes for coredis-4.2.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26703c411bb278f00321a1dfb4e0392bd7145274240020410d002715236688d3 |
|
MD5 | 875fd48d6326b9c8f1c370054ecdf379 |
|
BLAKE2b-256 | a4f0a2700a03a885327d593786fef2252b3af641f1672668227c8eb0b884c1ed |
Close
Hashes for coredis-4.2.1-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aee40de18119d683e23295b391994e9d803458279c55ebfd5e9f057d04bdf9c |
|
MD5 | f65e21e19c6334cf2670fb564bdb256c |
|
BLAKE2b-256 | 1a6dee5ab3117f15698a0b0ea41b98ec92bf39548499ba2d2034596cecc4bd68 |