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.2.tar.gz
(188.1 kB
view hashes)
Built Distributions
Close
Hashes for coredis-4.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4cca7880ec26e5bef076cca593f00f92c07a657ff435633cffb4cfa3f2a7192 |
|
MD5 | 90532225712e2c2f3247a0afb03b8df7 |
|
BLAKE2b-256 | 846cd5fa0282b567170ee4f3eb7ad11ad998b82e55ba0cc9496eb86ac5ab8b80 |
Close
Hashes for coredis-4.5.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99d3d37870820b8f276c1a15de15b83682577c9da94f1f418ccf92d489940388 |
|
MD5 | 291c72fba06e32142ebbdf35aba1a908 |
|
BLAKE2b-256 | ccd959753eff5b7fe0c3c4d4674924a9d01510e2c4226c840cc138c34342cb55 |
Close
Hashes for coredis-4.5.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 079cae3c12f816c4dffdfdad76f367bbd32174c9d4fa2aa1d82fde1f3af307e6 |
|
MD5 | c2921889c6527f57494db22e073eac6a |
|
BLAKE2b-256 | cce586d8e8f24a8dc321430ab1d97ce017b6b7258b3ee55cdaf96573c4ccf01f |
Close
Hashes for coredis-4.5.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f4d207650c40d5c63f3da00b4db488a83d766a440d13270754aed0c135a9c46 |
|
MD5 | 36b33699a921512f6fb8956571667a6c |
|
BLAKE2b-256 | 5d80ab854e142b0ab7e474bb748420220732e2ed593b2996c1e2dd5662a39651 |
Close
Hashes for coredis-4.5.2-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88f34197ed025326543f15198b1276e14a6aefb61c1f5ca478d2e2511e34ed80 |
|
MD5 | 5af88b4a60360f70a73c2af572549c01 |
|
BLAKE2b-256 | 85c3f5ba681d732b0d6326f4d786d4f9f3c0c45f041c02af9b289421cfcbb037 |
Close
Hashes for coredis-4.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb1db055f93337450c4a2bc3fe767a4c48d42f9ccfff14575d94ffe972915827 |
|
MD5 | c82d295ad6bb460cd4b3d483712d3931 |
|
BLAKE2b-256 | ae592cfe8a9069c941fdff730ff8c9e3105bc7c8f5a6691d4badd558f70c0853 |
Close
Hashes for coredis-4.5.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 766fbcc2a91dfe3bd67714399fdbb313ec43cc8675229df63b32c100a95195a3 |
|
MD5 | e6ea3a35476941efde327b27395380d1 |
|
BLAKE2b-256 | 9285d8dfc9b671b76178667c3a1bcb9bbccf0eec520bc57c3de3825e7f9a5206 |
Close
Hashes for coredis-4.5.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5c192c5792396b3ec9e4f1e8f728a5ccced3919e00a5664d6186d468413029d |
|
MD5 | c9f6aa525678bc2477f67b3170716300 |
|
BLAKE2b-256 | 4c5d61d87e839deddc25dd29ef24534323d08ea910102aba0785ce7214acba8b |
Close
Hashes for coredis-4.5.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c5f26f19b0f5d57dfc2854a51f6e1ba8703d836bd2af6c4994ba24eb843dbb0 |
|
MD5 | ad2842b36e0c75541bb72842b271884c |
|
BLAKE2b-256 | 272663031047f0276f7d08e8cf93abd9b838d1593af3249b11ee901b14ba7377 |
Close
Hashes for coredis-4.5.2-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab1866f579e91f587856301279853d18aa4744a0072164a8302796f204cd94b6 |
|
MD5 | 122ae1bc8ddc399811ac240bf3806496 |
|
BLAKE2b-256 | 1512f4aa3c1a8c958b44974ab56272ba1cf6c2f193fa0c2054fed5204a836a0a |
Close
Hashes for coredis-4.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c6766f813cf49099ef4ba8df8902c29168e32818db4c7c9acf13e446b9b9370 |
|
MD5 | 689ec68a778f6ea46226d83857319a57 |
|
BLAKE2b-256 | 3925c07eceb58c75c223bafbb59dcc81703586276d71b544f54bda435ab2ad1b |
Close
Hashes for coredis-4.5.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e2fa3f627e9d0a3acade449e232c8fc85241e129b2ff94773df3fbd5201a614 |
|
MD5 | a2a5233c6f6e9bca7875a91be5e4e6b5 |
|
BLAKE2b-256 | be7ab70acae6192d4cd2b2fbb914ecee6643e963478a63846b7dd25d57344fa1 |
Close
Hashes for coredis-4.5.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a88a607bf48814b19221cda2262070bb288febcf85fe54d1ff7bfab8a23943c2 |
|
MD5 | fadb59a65b44a01741373d0c72d5c4bb |
|
BLAKE2b-256 | f0e27f322c904b3fe4e2c94ded0073ddb5b5cec2934563d8d7cc0f62f5f03322 |
Close
Hashes for coredis-4.5.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21899410416d516c3a91a7e5f5d1a9d465b030dffb707a8d6d5d0f4db7b42483 |
|
MD5 | 27a8d6df36766d4550ab9e6b135d2909 |
|
BLAKE2b-256 | 55cf6f984b7aafad5481dac77caf127097d45ae6a8167c16fd962ed2b10f006f |
Close
Hashes for coredis-4.5.2-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 766aae1058edb980f29faa8e3919e93d7ede0a5be6579bae7fcc2f39aa600163 |
|
MD5 | d45bef349fb926ece9652a00048a0f7e |
|
BLAKE2b-256 | 70e1b33cd06e5f22cf47ea8176c1afa052ed18ddc62da71fe6523181b689e7bc |
Close
Hashes for coredis-4.5.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e3a5909dd5f5b30496bfe99972698fabc67b1e44cee9f82a033f8748ea67d6c |
|
MD5 | e0a92484dabb0e047477b3e611850c0a |
|
BLAKE2b-256 | 8fba61bd384d3c9cb71def765347d5ff25b2f15066b24730abc456285944f7bb |
Close
Hashes for coredis-4.5.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7419c0f040419a8331e50bc87d8078fd25da714e6d1238f409d87f6feaae264 |
|
MD5 | c747b998fb53da5c8d5412252eb077eb |
|
BLAKE2b-256 | e7048e89556d417a419ef8560a19e1aa064759e93491ccfaaec18c64a3b9384b |
Close
Hashes for coredis-4.5.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9549bbb953c7afcd9e719cccad45af58dfbffecb606cc7953112151c7502d2e2 |
|
MD5 | fe81dac7ccc60a90f6d28100ffff06ae |
|
BLAKE2b-256 | c5a4c9bd88c5374ecb2d76af58a95dca68ba2264b8a52d3756ee7331d51cd95f |