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
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.0.2.tar.gz
(181.6 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9abea92bd476e983c122da86b4bdeaea135860d8153b5a83a3799b31e17ec10 |
|
MD5 | fc8f8f42a24d7086e96d57d4e647db73 |
|
BLAKE2b-256 | cfff30663733b06a6b1b3104dddfb612b4aafb149db9e6c2fd18620a4cf6b6a3 |
Close
Hashes for coredis-4.0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdfdd1a4c43e49699a04ebdd4f6cd01aeb195905d93641ced2a7f5e28556dc1f |
|
MD5 | 4438230bc48e5160a61eac970737d8f8 |
|
BLAKE2b-256 | 75ea31a92332dbe24d68150f835aaf9e1045ebff9ee90bd8760e9900060fc116 |
Close
Hashes for coredis-4.0.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ebe17cc87637bb7cc3db789a008ffbedeea5ef2033e10c4f0e531a0f6c0f528 |
|
MD5 | f289b5087fc043002322e750e48adf1d |
|
BLAKE2b-256 | a8f9c2c9589c23a6bb52fd0b1deab9260a33a4baeb0b4b5df6120bb056042b0d |
Close
Hashes for coredis-4.0.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61f168be66a15310b4999760a078810a7bc0dfc39eecd440b5efb481cb46e386 |
|
MD5 | cad0ba0287b69d21b75e49321cc2e99d |
|
BLAKE2b-256 | a25f1d64b552cf56bf573a2fa13a676b58cfd1c9042d60caa4824365863fd863 |
Close
Hashes for coredis-4.0.2-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52042aee7e635577c70888bdd68ba9bfbf04e9bf51842958f54436068c1157c8 |
|
MD5 | 2105997000df1a249fd5b24da2b348c5 |
|
BLAKE2b-256 | fde7aa900662d08a6a349847ef8b34e039ec9250d6269e4cb3bd8d592fe770bf |
Close
Hashes for coredis-4.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b911923086aa715c2bdee00b6773a89e891501f637329ca22ddc0644ff3a53e |
|
MD5 | 9b05abfa0a2117544b0e1c55110a4e31 |
|
BLAKE2b-256 | 4e0e1758531c3b76c89ff2636286791bda9b68484d82347ef399460306677e5d |
Close
Hashes for coredis-4.0.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a00ceadf2e31031b6e66d46f35bd889505e57a69a083633cc95459ba56608d17 |
|
MD5 | 9d0082554343bb8532e8ca99628297ce |
|
BLAKE2b-256 | 3cf4b54fa078b277a7dff61b9cd1dc48f9c246c32c37c9c0119bc0f53e2c2cd6 |
Close
Hashes for coredis-4.0.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a241ab478e2a64ef25584c40b00a337835e292b04bce1e2e8c51a01e9731097 |
|
MD5 | b35b90a6ba7b6ed1244210be94ef8f3a |
|
BLAKE2b-256 | fcf1897c87c8ac8fe8f2d98c9e6461a9390b43ad44b8e306aa5c43f23d215f0b |
Close
Hashes for coredis-4.0.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76a5b4824170cf0745abfcef9401cac3a2b7748b89e994ab8278166b60e55b0b |
|
MD5 | e527dc565bccacad73f5737548f87df7 |
|
BLAKE2b-256 | 33c51bfbc2a9b9a4cfe98d3036297926aba73735eddeac015df2dbff8e0a2403 |
Close
Hashes for coredis-4.0.2-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b32135779f11441fc9f766a061eee3dfd39901f690b7d387341bffb9dfe52be9 |
|
MD5 | b8d47ffd1120edc6a4b00ef0afa955ff |
|
BLAKE2b-256 | d753bc70a04847a3f7a51df6b42973361a912f13820b0aeac760151c9f636f3a |
Close
Hashes for coredis-4.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb5ba06f6787b6f6fdefc29f08cb2c354fefbda25e8e8553ac52852d0fc646f7 |
|
MD5 | fed7ae781d34af88728b2c53b2328922 |
|
BLAKE2b-256 | 09eb90e58df89714e2f46cff4c37f6d488638b6d4772737f43d98dfca1c9b8ff |
Close
Hashes for coredis-4.0.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56dce88e9008f461ab37b1f0c70bf0022db8f998599386fda69a2c74f16f628a |
|
MD5 | 4d458f85e8181baf543a547b37900a02 |
|
BLAKE2b-256 | 6e0d7d6b3b4e352703fa61d78d483e5cc051981f47c42fc5780ec4df6d637a82 |
Close
Hashes for coredis-4.0.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be32b352572fd9386e2d37d9b922be857dd93493bc996fa1c5d3b39ac2103b7c |
|
MD5 | 3a0da7aa0393fada8f6d46587a39cd94 |
|
BLAKE2b-256 | fc34ef83999da807555d44870fe2ae6505e1bbcad90f5846a0e12a8b22ee0e3e |
Close
Hashes for coredis-4.0.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c81b73cd85ccd013dfb13e6d526f6efd64293d526886d2f34bd4aa5dfdbf4af9 |
|
MD5 | 1ee32f9236665ca0963936875db7789a |
|
BLAKE2b-256 | ec898e4199320f8864e7c2b1b00b28e8cda51f5a135b745b20a7febfc1d2039e |
Close
Hashes for coredis-4.0.2-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de6a6b7d762cff3021d06279768c8d00095858512ecc9a895278eb7b2872717e |
|
MD5 | d0d98527f93c83be0d105fd4e5de0b85 |
|
BLAKE2b-256 | 626625911f60d15c2dd16f0f7219216a39d12a9ca452539aebc2c335582fed4e |