Python wrapper for redis-rs
Project description
- Python wrapper for:
Features
Async client for single and cluster
Support typing
Encoding values to str, int, float
Install
pip install redis-rs
Using
import asyncio
import redis_rs
async def main():
async with redis_rs.create_client(
"redis://redis-node001",
"redis://redis-node002",
max_size=1,
cluster=True,
) as x:
print(await x.execute(b"HSET", "fooh", "a", b"asdfg"))
print(await x.fetch_int("HSET", "fooh", "b", 11234567890))
print(await x.fetch_int("HGET", "fooh", "b"))
print(await x.fetch_str("HGET", "fooh", "a"))
print(await x.fetch_dict("HGETALL", "fooh", encoding="utf-8"))
print(await x.hgetall("fooh", encoding="utf-8"))
print(await x.execute("CLUSTER", "NODES"))
print(await x.fetch_bytes("GET", "foo"))
print(await x.fetch_int("GET", "foo"))
print(await x.execute("HGETALL", "fooh"))
print(await x.execute("ZADD", "fooz", 1.5678, "b"))
print(await x.fetch_scores("ZRANGE", "fooz", 0, -1, "WITHSCORES"))
print(x.status())
stream = "redis-rs"
print("x.xadd", await x.xadd(stream, "*", {"a": "1234", "d": 4567}))
print("x.xadd", await x.xadd(stream, items={"a": "1234", "d": 4567}))
print("x.xadd", await x.xadd(stream, {"a": "1234", "d": 4567}))
print("x.xadd", await x.xadd(stream, "*", "a", "1234", "d", 4567))
print("x.xadd", await x.xadd(stream, "a", "1234", "d", 4567))
print("xadd", await x.fetch_str("XADD", stream, "*", "a", "1234", "d", 4567))
print("xread", await x.execute("XREAD", "STREAMS", stream, 0))
print("xread", await x.fetch_dict("XREAD", "STREAMS", stream, 0, encoding="int"))
print("x.xread", await x.xread({stream: 0}, encoding="int"))
print("x.xread", await x.xread(stream, id=0, encoding="int"))
print("x.xread", await x.xread(stream, stream))
asyncio.run(main())
Development
cargo fmt
cargo clippy
maturin develop
or use hatch envs:
hatch run fmt
hatch run check
hatch run build
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
redis_rs-0.6.7.tar.gz
(19.2 kB
view hashes)
Built Distributions
Close
Hashes for redis_rs-0.6.7-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54f35e415603d1f8957d3fafedc2b6ff4a7e615f715c197bcfeaa1391fb9fbbc |
|
MD5 | e9bcfdfe3a8aed92ac8a52bfbb095bfc |
|
BLAKE2b-256 | 8cc48e84de831473084ca09dcee0a6c284f8b3c89e1e5ab8d1758bb68f8a9441 |
Close
Hashes for redis_rs-0.6.7-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cea1fc7fc6bc0de75df3db263f9f90498fd620cba391afda3c965207d833f4a9 |
|
MD5 | 1a7e36a6f453b6f4c25d2fffac91e95b |
|
BLAKE2b-256 | 919dc0a379e7586558d5c070586a8e1adff6be32c060e3670e56cdea9ae4b7e1 |
Close
Hashes for redis_rs-0.6.7-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79916acb18886729114f6e348ae6a8a82148c43f24168f9d43eb4d3c90b3f2e9 |
|
MD5 | c9def80e42e36ff46c91c089cb8c954d |
|
BLAKE2b-256 | 6caa5d62a3e12a56844e4b720aa0e775b5f78d23946518a8452937a977906ea2 |
Close
Hashes for redis_rs-0.6.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e9a3d6b71bf1f4e4196ca9356317818c65be5f1413bc5267569488c4900958e |
|
MD5 | cbf65bd954ec04bbc6ab1e0eb0e3108b |
|
BLAKE2b-256 | f89f4e78b98cd925b43792835f34d8e24f8d7b9bbd118c24c061fe929e906050 |
Close
Hashes for redis_rs-0.6.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97ee2da2f371ed09a7a097113e2e03ae26b135c957fa4b9bdc1ecd66b763409a |
|
MD5 | f64aa6441581bd7733bf5d027bf77795 |
|
BLAKE2b-256 | 01c105fddfd8b42a362a2b28f7c069bc1926de7ab1a74220b0c117079d5a880f |
Close
Hashes for redis_rs-0.6.7-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34b1691342c497e77e198b810de932258865ca6c8ace7dc4fb74c70aa2d5707a |
|
MD5 | 509e1ff4a873a99db54391b3be38b4d0 |
|
BLAKE2b-256 | 876274e3717cf977a9cd441aba3be6fa6807881d5004d81e4b3ab2ac3e7788d5 |
Close
Hashes for redis_rs-0.6.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff447714ea05dcbc9cc68073b5568f0b8d5beb468e2c743e7d2dd0ff838174aa |
|
MD5 | 21b2a9c0b81470d3eb82154fc108738b |
|
BLAKE2b-256 | ec35e88dac2505b37d63ea75863e031f3ac4a8ee85256e8d64263b4b7db6e578 |
Close
Hashes for redis_rs-0.6.7-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b26ad352a4faad76c7d58eaed5bd7b7915db4fbbc99f52c72e5b3092fb67ba7 |
|
MD5 | 1858a98481754e49e60bb959841fe5df |
|
BLAKE2b-256 | a7c4d9162fbd5771cd2142c52e63fa53c808ddc9478b9a1dd19cf76890b243fc |
Close
Hashes for redis_rs-0.6.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea57607f9bab169572ce213c9ab230dd959348618222dfb0f994d6387ffcb6fc |
|
MD5 | 5c1e896d9484aa8c7ef8ab8f3b276712 |
|
BLAKE2b-256 | 9136da6016e07ada354c994d636bab579dcdebb40a71a41650fccef30e54d123 |
Close
Hashes for redis_rs-0.6.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 243e81567e8623d66d8e0867a4ac6932bc0b9f93bc0b4a14812759f051a4d753 |
|
MD5 | 3cc3beb486570f0032a89a7f3289b74a |
|
BLAKE2b-256 | 7a241c2ff57f70c342cd5b1c8d608323dd76944e8e194be76a655d5b371151fc |