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.7
- 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.5.1.tar.gz
(187.8 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cdc1f973ad162530794c47839ed70b6998a0b06623276a983370ab448d20a50 |
|
MD5 | faa2d45abe1fb8b1a6a09b6f301647f6 |
|
BLAKE2b-256 | bf2ed01bef303fa8bff2d2ff780af122d9cfdf361280ca57c723dba4aa2b0176 |
Close
Hashes for coredis-4.5.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18b8f8fed101aa29b042d60d1170a407dcd2401db7a067c446858c1dac47bdc8 |
|
MD5 | f9f91010e2bb61a7983731a8e076133b |
|
BLAKE2b-256 | 5a65591903d4ebb88b675079ffd052921b557a42878e4a8155f6ab6f0cae751c |
Close
Hashes for coredis-4.5.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4aa84b220dbfd588749ed0cc6051b3bbee1f94aeeea5b5aa9b7327cbede3bf75 |
|
MD5 | 48e293c9ecd82c301ffb3358ac77161d |
|
BLAKE2b-256 | 430c9197c41c49d0d999f8cc7863e9c5dc844211450774e5fdb2f58ada123222 |
Close
Hashes for coredis-4.5.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb7b7c47b8a6678501d49878cc727773e2fd7a3e997185ee7e03316b911794c7 |
|
MD5 | 88dcaf7b119bd679d78b61c8eebd1027 |
|
BLAKE2b-256 | 99ed736f570a335ce20d0b7ede58b76d52e843df1254720627bd4071e6c1face |
Close
Hashes for coredis-4.5.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe353d4c9bfd2880ba492a07a110f4471b358741fa92a19ab7d9a2e1279c70bc |
|
MD5 | 41e251670c480e80f0d5235216d79e55 |
|
BLAKE2b-256 | 7c077e5f74c59bffe1ef3f80348bbd28ce210cf7befdd0ec810aa13ea4edf394 |
Close
Hashes for coredis-4.5.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d42c031e0841c1f0e5e90df09d53c5aaa60c3b0ec44c523b9f3231f3e6b0cf49 |
|
MD5 | e14a1a5aa39245e8c8e89a417e082020 |
|
BLAKE2b-256 | e26bf4f071e094e55703fea19d20f856b08cfbc97a72ec03677bbd328f5e4c3e |
Close
Hashes for coredis-4.5.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a9d06078291ceaae7e5e37bb9c4eb018305c9f1db8b011758a18d36cfa0bba5 |
|
MD5 | 7ade4c09ccc76fd683db8c8629b7e061 |
|
BLAKE2b-256 | e3837e6c7b5706fac6ecda31d7b4fb883f1d46a7d4bfd8d207d5bbfc929250ee |
Close
Hashes for coredis-4.5.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 235f0a1771f237c01a9e4ba255e636816555f4ad2f719955211b885c8d59ab22 |
|
MD5 | d2cc4b9f051104d36d94675eee88a826 |
|
BLAKE2b-256 | 2512d4e1e99c3b04ff5d7f2fbf97cb513f57c5e1281b61f4d1d0b26fe91e7245 |
Close
Hashes for coredis-4.5.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff53f49a0b98ce63cef4635fb88889cc7708a10ec34cddf899cce6afc49bd12d |
|
MD5 | 9aa0c527216c3ec71c2ce2081025f063 |
|
BLAKE2b-256 | 3c5fecdd6f830b92a7d1343b0da0a042d63639221d05f4b888f86013f92a2aa7 |
Close
Hashes for coredis-4.5.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 217a8fb710f27c198894b6dcfb4c6666a38c11abe496a9ff4f73e037ea856a9f |
|
MD5 | f4fcba44b75bf115be54c825de4a71fc |
|
BLAKE2b-256 | 2974d086d845df763479239d2e113aa34206ef6fb53c0e864e00cb04d57ce112 |
Close
Hashes for coredis-4.5.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 065c11ccfd45c1149006304384050b221f7a2a1a3e56b9cd699bcbef17d12219 |
|
MD5 | 03456f5fe0e7306df32c8d0fee7f0a01 |
|
BLAKE2b-256 | e95d8f0a4d2e93358fa167005a19e740cc4d9c65524f2f118895c9865d04ba4a |
Close
Hashes for coredis-4.5.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d0fefd5f9936f816108b9b762d306085ac8929b69aecc1e41e5d40a70c6afb2 |
|
MD5 | 5b1c76f616594c73805ee6246b2fe52d |
|
BLAKE2b-256 | 220d3f02e5a8b3e210735791099b5eaa6c1c80a5c407cccee8fa3b74bd87401f |
Close
Hashes for coredis-4.5.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbfb3734febfcaad0d36b184c504461495722d08c6d474160d7e348151beaa10 |
|
MD5 | 9718b37ea3a32360e6adf722ca509eba |
|
BLAKE2b-256 | 36ab27cbf3e1def94273eca378508ed03cd44e51f7ddfbc7ee6c7feab6e8580d |
Close
Hashes for coredis-4.5.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5740e7c389720dc6aabbe57bf9c590f9a230fe2cc4dcd1169aff7eff26e980d |
|
MD5 | 6ffb660c848f71722271655c41788cd3 |
|
BLAKE2b-256 | 55e1e4864b9bb27218886ddfbd39c2c860ffef209b2c06c59f8bf92d32f009a0 |
Close
Hashes for coredis-4.5.1-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a059ceee666023687b4670ec9c3f1f51afa8b5dfe58293857d2d8a291269825d |
|
MD5 | 8aa5ea2695ba33f4b8ff887906bf20e1 |
|
BLAKE2b-256 | 500028656c99d7ff9559b0197cf4c35d53f0ab99de17bdded3034b609568365a |
Close
Hashes for coredis-4.5.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 903e6283f6998531053628b28d230114480d44bfda0cefa8a92d78b9fe46deef |
|
MD5 | f8ee4a8eb28b99c8dd27ad06ce199496 |
|
BLAKE2b-256 | ea815ef7734243ba47adeb62564ea89d2af1f355dfd1f73653770046c0cdfaff |
Close
Hashes for coredis-4.5.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f3553b67f4066786a6504f19b1e5ffa02ad0fb02cdc69367403c66af93e43f0 |
|
MD5 | 4b4273354436484024169d693bd83d65 |
|
BLAKE2b-256 | 08c694663a654ac1e8b39f44f035ceb276ea1f2c6545b8644fc1bbc21b59f873 |
Close
Hashes for coredis-4.5.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4525643ca9e98728712fdf7db2f9ffb2390f130d03c661636e094c68c95b38c9 |
|
MD5 | 4c324917189161f43e7fc73250b371ac |
|
BLAKE2b-256 | c834bf0df94f003e97b46eec70e4417a07a88661ad4b4f6cf3163ee69376d041 |