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
Experimental Backends
coredis has experimental support for the following redis compatible backends:
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.0b1.tar.gz
(181.1 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.0.0b1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfbaec76f6df09c5a426fbcbf69b3bb646fea0bdc45d8d83b4eff631436156b1 |
|
MD5 | dd06dbf1fa139752fa90ce8b99f977e9 |
|
BLAKE2b-256 | c003a797fcb2d533c8f0e98f79890c48ca7c8ac19dcf3686541be873bcbb21db |
Close
Hashes for coredis-4.0.0b1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d706f073aff812049d561d9157d1909e1d764b5a6c1134570ed9df12d858683c |
|
MD5 | 5f9af8af4d7f48e96087dec9ac22403e |
|
BLAKE2b-256 | 82234608a613b7a0f8ef6056ec9b96f296dbd8083aa602703f1fd0ea4ad75031 |
Close
Hashes for coredis-4.0.0b1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24b72c1091f89ce83afd58d9b6c34e6a260f0a12f3019b66fd0c995b9817dd1f |
|
MD5 | 78baab66de6ac348780be4c94595411f |
|
BLAKE2b-256 | 047f3535a13ffe186041bcd602a446e6af492ea50423956138c0a3d9449f7f20 |
Close
Hashes for coredis-4.0.0b1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 773e404f4f34eb0130cb0834d33b5539a3579fab13aab8094ed0e3831e276023 |
|
MD5 | c0a8b7ba81b077420b878abbfcbf1a58 |
|
BLAKE2b-256 | fdf0782b059aec997ccbee2045530097e8800787219d47e3cefe1173bafd64a9 |
Close
Hashes for coredis-4.0.0b1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c96eb87d81dc05c50f8ed5924cdebde185739308b9f339681d8933533726fe67 |
|
MD5 | 434a91ceaffd75077574a3a292c35476 |
|
BLAKE2b-256 | c0ccdc813d554a1944d17670be424a177ba4f64332e9ec195d4ff77995d460b9 |
Close
Hashes for coredis-4.0.0b1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28fe1468980b287b253ab6eb6d0863dd88f523b32697d6802a57283c29f86d69 |
|
MD5 | dc47158e2f3273e4c0930232561f64d5 |
|
BLAKE2b-256 | 684b80e967f22c12e248875809c74ff0b29abc4cc0adba430a2eb69536fdb598 |
Close
Hashes for coredis-4.0.0b1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06813f0d8e244faa7d17e78ad8c247e291834e675630b7d229ef51e2edbd43d1 |
|
MD5 | b548ffafc814678bd5095744b9490fdb |
|
BLAKE2b-256 | 33db18dd195afc154d806be11342fbdfd5eb3756bdd441c524be8881a0d0b0c5 |
Close
Hashes for coredis-4.0.0b1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc234d3d164d8fdbcd2f2de4274d9c9232faa96d7bec7f73b1149a2b3a33e500 |
|
MD5 | da2a41c35a9525ef4b7e30438180d7e6 |
|
BLAKE2b-256 | ae7f29491250b4db6b7cd25dcbfedc3fc3f2a9f868b1e41b2d5286a8f7f1c5cd |
Close
Hashes for coredis-4.0.0b1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf2175ab340dfb24240bd3a76745f8d7b4f93c016905d0460910421e9b4c82c8 |
|
MD5 | 81dffbed62f6c0035ba8e9b4ec7d75c6 |
|
BLAKE2b-256 | 4241650d1431f8d38875d3cec5ab6f97e857f818d5150a0a5cd6ec052e7e6947 |
Close
Hashes for coredis-4.0.0b1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98726917c08c9d9e8610c030b3f4abd9b4d1668d34ce55696e7149199ae5831d |
|
MD5 | a4a08045bd04d3f9234d6da24c967081 |
|
BLAKE2b-256 | ad5d75b1eff6cab378fc6ceec0db66ed6a0914ec96107705344e60cdd3e46ae7 |
Close
Hashes for coredis-4.0.0b1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c00941460442e9736bee6780d2b5f0a2e8f92b9d68588a888bc074bd8f9b857d |
|
MD5 | 318b2dc29079d9f9609431698322f9bf |
|
BLAKE2b-256 | 8abf94cf0154c48a9cbcede6ac7449286e6fd90b66d84c04d8c3f7174aea63e5 |
Close
Hashes for coredis-4.0.0b1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1514138352222928f6659da297af9145433ebd210ce24912690331cc4ddb899b |
|
MD5 | 77c941f76c75897573658a5a9091a9e9 |
|
BLAKE2b-256 | 8f000445e38fbc5ce4949c97eb36902d8db8b3a5908f74892db1ab19f8a49c7b |
Close
Hashes for coredis-4.0.0b1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2da39589671b360ebedbba84959cca0adab2b1420e198654040e47d030df3b8a |
|
MD5 | 407f72229831099075b785f998083d8a |
|
BLAKE2b-256 | 6dc996486c4973a6c00eae7cc50e496ecec50609f897c7cde1d61e336c546e91 |
Close
Hashes for coredis-4.0.0b1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b020dc732360ce1237b3bec9447565a5b0b9828fc22f5ef824fca1f1f8eaacf |
|
MD5 | 0d09e9ac0433f3df8085c8398f92ad5d |
|
BLAKE2b-256 | a1113bef43468041eb9ed7ee924f305e1d2006fec9522b033a94c0d4b72afb10 |
Close
Hashes for coredis-4.0.0b1-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8eb2566b4c885e887c8071fcdd33fc39ab922a620454bfae4e59ba724d84fbb0 |
|
MD5 | a73ab04d67d9ced243bf02e16b63af25 |
|
BLAKE2b-256 | 3f819b14d4e0bd523b752ecdfe4b46145c8c776b812f10cea2c2b0b759a7932f |