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.3.0.tar.gz
(186.6 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf88c5a3f3af0926440c2df909c8dcc0fcbd6e49f98480e23b58dacd80ed2706 |
|
MD5 | 828d9a77e737173b6172b19947329c9b |
|
BLAKE2b-256 | 31ebbd760ba9f7967a631266be106337adf9e7dd0d0748b98aeb9b6725349773 |
Close
Hashes for coredis-4.3.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d78cfc25ed7be926481f98272801f0811765cadb023077ba2a774180c74f443 |
|
MD5 | e8942696e1f1710aa0df4de7fc185f79 |
|
BLAKE2b-256 | 2789f1052907722c0358c59fa35b64f5182182d8c1bfa2da05e50b3af07b82f9 |
Close
Hashes for coredis-4.3.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dbf76c09ad63fbf70a3c528fc2d97186300edc98421ddcabe8d09dd3e62e69d |
|
MD5 | 1a54ceb3b53d0dee08df4fee4aaba6c4 |
|
BLAKE2b-256 | 58dd6327f1776fab738e7b0fc5d0518e585feac8857331448eb3a07ed024b84e |
Close
Hashes for coredis-4.3.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cbdff9879913cd66c0b47fe3817e6f8ef5ad15ed29bd6b0f2788e96f42ea08c |
|
MD5 | ded090f879872305b51e370f8bc229dd |
|
BLAKE2b-256 | 77ef4487139a1b94bbb4cdefa888f4ca3274c9c90d7bfdd13126787f9b4c0810 |
Close
Hashes for coredis-4.3.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b099fd6ab1258b9123e87eea882c53af3dbf5b381eefacca67ebac94e5bd6342 |
|
MD5 | 1d5e7bf79fab07a4173bee6efd406dc0 |
|
BLAKE2b-256 | 9ebf3145614da19b78e42111cb4ffa020427222e3a6c9b79a8f2126c94a8004e |
Close
Hashes for coredis-4.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1561bb3955a38e4c964a0ac9385bb627884e2c86d988eb0f84663f54d8241b52 |
|
MD5 | 6bc2c2338577a889b9f9866c1f904c0f |
|
BLAKE2b-256 | 791f5362250723449a7a66105ffa33da38e25cd812873f252f12bf04fffbef5d |
Close
Hashes for coredis-4.3.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7188b947088bf8e335a2715f22525553968016a8b39e2fb1aa1607d0b88189d8 |
|
MD5 | be15e95e17d9280dd96c5a83527750b2 |
|
BLAKE2b-256 | 947dcc1755089f477cf62dc13922fc14da71a3215f26e141c129b2a3da99e8b8 |
Close
Hashes for coredis-4.3.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03dbcef7a70653d9a0b139a02aec0c670bb3297885fe7cd8fd436db8794695ba |
|
MD5 | 8d130150f694442f09d9af5121c59a0e |
|
BLAKE2b-256 | 9fc02f636c23b12178380727fb052ff8b1ecc1464d07f79e94837342c7932aaf |
Close
Hashes for coredis-4.3.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 025b3fc9db3cbb08617861ea9cd6a6678a1460468f98af84f06592259c4ae065 |
|
MD5 | 935e56b099946daeb6fc3c29c7409e27 |
|
BLAKE2b-256 | 26a863f3a19c90302dc87ffc42b2ca4a8aeae4f663282b791c4b2ed4e589ca08 |
Close
Hashes for coredis-4.3.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d25eb971e58bd7480872602534cac3261811cc6f878de319ef170f2f045b735 |
|
MD5 | b4f734bd8ff629554b7e0ca0c37744be |
|
BLAKE2b-256 | f2d09e962726890f681eacea0106d90778839f395ab2f4f893a6b5e0c241936c |
Close
Hashes for coredis-4.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41958cf1693ff0696842598dda2840d7765139e30699d2885adc21fd29059168 |
|
MD5 | 66e792bf56796adba95ee3a0f2a03f4c |
|
BLAKE2b-256 | 1a1a2a062b26d47dda46758b54fe2842a4b0f7031912aa9d99fa9334b79cd724 |
Close
Hashes for coredis-4.3.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27e509ec3ba46d7434923beecd487c72948d653e174f40575cf4cbac8b6d2541 |
|
MD5 | 6f4c891399ab252782e11a3db5887303 |
|
BLAKE2b-256 | 9986e1a06c6e5dd5c406be9aaf22b81622979e1b5f7a5b874964a4f4d8fbddba |
Close
Hashes for coredis-4.3.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fb97b9a819c83360d8cb169e24d324d21fd84cb3e52722280f7f9164d8fbcc4 |
|
MD5 | 8a52c580f56b3e750cdf17213b36401c |
|
BLAKE2b-256 | 86b8eb9b63a675de44d94cbbb1110ad7b11a05d45ec40d7cefac08da348214b2 |
Close
Hashes for coredis-4.3.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ea3c8e4644cd2779c9a93d49a2ffb0bc1b1829b361723e1efc2479b3955db26 |
|
MD5 | c6ab392bb37073d4f0a5c6a9744dd0fa |
|
BLAKE2b-256 | c53fa0d5d80c6d15811ff657d4bfa6de968683b52053aef4fbea8a078fad49d0 |
Close
Hashes for coredis-4.3.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31d9756052b2cf4e38dc6ab468f1846ccd078510c7abbc1a37400c06b8790691 |
|
MD5 | 4b8238d36d44f1a6865b8d4a0ea928d4 |
|
BLAKE2b-256 | f4e83e64cf9f10d6d54e26cc0167f47a729768a56275ef36593c921fbe6916a3 |