Python wrapper for redis-rs
Project description
- Python wrapper for:
Features
Async client for single and cluster
Support typing
Encoding values from str, int, float
Decoding values to str, int, float, list, dict
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:
info = await x.execute("INFO", "SERVER", encoding="info")
print(info["redis_version"])
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.10.0.tar.gz
(30.9 kB
view hashes)
Built Distributions
Close
Hashes for redis_rs-0.10.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3972f2847e39587128558eaf36ec6f05743f3370c28fcc58438726ff1efe755a |
|
MD5 | 88d9b03c1f4f12f69abc1be912f69bb5 |
|
BLAKE2b-256 | 2e331bc5ddcc5416b4bd3b6dc3b964a603a0633b2fac876ef64c1aa09b70b93c |
Close
Hashes for redis_rs-0.10.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c967d85e734f3849a8a95bf887c6ce919b36fae955400fd6db15c2ab33852473 |
|
MD5 | 933ba494fc81923c685f0f4a11271175 |
|
BLAKE2b-256 | 1d0b051078d828010fc60cd630577f8ce888bcc3897d1b8f917a0887fc8939e4 |
Close
Hashes for redis_rs-0.10.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 879b326530c215d72e9ef545ae2d3531160e2e0a5d899b32c787948081f2f1e6 |
|
MD5 | 0165bf5998d5a2e32dcbe8b514fee42c |
|
BLAKE2b-256 | 240b6483a2b6ffdb61729ae9154a49b76a30426b0cdfefaf6c0540035eb50c2e |
Close
Hashes for redis_rs-0.10.0-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a84b06306efd03649ffe20ad821cb630a14fa8d714a2fe87ce0cf5f405b92be7 |
|
MD5 | 5512ab287b596a3e2da6c6d3a839f183 |
|
BLAKE2b-256 | bcda82269cc7386e6643fd8e7d3c50a3242506d4fb60b3949e4d0fbef68e27b2 |
Close
Hashes for redis_rs-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a2d61d3c14ef4cd992dd63e6894d1fc7170f43b4b05aa8a543ff05b7b7b2959 |
|
MD5 | d6f0a8deae055f69b0e31a5a3fcf9f41 |
|
BLAKE2b-256 | 39ecd39511cbf8ec46e06cf6cd10e5d73a501dcd2411d24ea7a5024c42a11292 |
Close
Hashes for redis_rs-0.10.0-cp312-cp312-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3111729a79875e4ff6de270f3c5b62e2a2c13f9a40ea43fb2d0f47621597fde7 |
|
MD5 | ded69d044ab8eddb992facb3b996d21d |
|
BLAKE2b-256 | c701048b6a46817939f79d41b1ef0e7eea9780c20470716d27d9adfa38287824 |
Close
Hashes for redis_rs-0.10.0-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53c074adc95bd69ea0d0df401afc810d7482ad4e77181dec11fb68c6b2261e4d |
|
MD5 | 6d17556156a0ebff7be71b4b50e09e24 |
|
BLAKE2b-256 | 97336efc4b8905c0da58073abbd1aaaa796807569e5a7d199b5ca01213941560 |
Close
Hashes for redis_rs-0.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c58ea417c2023e5ba28016776bf26ddaf10d482c69fc4eb53509c83751471f3 |
|
MD5 | 67c187dfedd3548131ede897c7c17cd5 |
|
BLAKE2b-256 | 7e2a716933ee05666fda3d9580ab30ee86a22f793b4a85accd074a56e74839b4 |
Close
Hashes for redis_rs-0.10.0-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35edc0d666abd5ba28f1a3363be5c2ef58f5b622593c398fcf925f23a446901d |
|
MD5 | 3c1311492e761a2b9a8cba84cfee989d |
|
BLAKE2b-256 | 02e5a554f1fcfba2cdde634681301d94ead4e3c1c90a97d2546a6fb9b7b5a6d0 |
Close
Hashes for redis_rs-0.10.0-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f322aacaa41628fe768d5f16cf43db62ca3c13a0edc37addfd14d23a2183d5d9 |
|
MD5 | 9ffeb06361409c91a28aae6be06a95c4 |
|
BLAKE2b-256 | 00edb5278a904bc651f186995d208159c0becc6517fe0260b041b5f69dfdcc4b |
Close
Hashes for redis_rs-0.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd309aa68ef53b5008089fc77a91aeb896a14ee742fc50dd93d043ce1191325f |
|
MD5 | d7ab9efe72b6199d58c1d97478fd710b |
|
BLAKE2b-256 | 3a838fd1bde1c2e0f4019c11b9650e6067fde688465f416fe77d9541a7ca4ece |
Close
Hashes for redis_rs-0.10.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1567ec6b1d4e950f998775cbfb4a42b52dfe81fcb13c6272cdbe182236dde6f |
|
MD5 | e6714750d32accc2a6f65587ac2e933c |
|
BLAKE2b-256 | a94bdc0dd195b9d80b8dbfe5bedd287a709f2655df89f757934964dcecc568dc |
Close
Hashes for redis_rs-0.10.0-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 886ad99d49890752f881a6466755807fc9dae32efeea0a634371e026ffd60289 |
|
MD5 | 9372519e045145c597f81e21970eabdf |
|
BLAKE2b-256 | 9d0a71620c9d7fb40d9ca0554e153ab39194111fc5670d1b5f02f5ba506e6d38 |
Close
Hashes for redis_rs-0.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5845cd4cb328f2e3f64c72fed0dec74d8ece328bc65e0d56946cbb6a0242e3db |
|
MD5 | 265980cdec88e111db127dbaede17762 |
|
BLAKE2b-256 | 82456b404b73ab77fa80a353803e67766b9ef0409066990d7c1d0002a9ec58c0 |
Close
Hashes for redis_rs-0.10.0-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7949448701ef44c701092066f76218a525379f95f2b27346231fe3d900edf11 |
|
MD5 | 50ac736b6dc2f0925e6e519feafb9712 |
|
BLAKE2b-256 | 65b1bb1f940b7252463d7b69d25fa565a810a148d01d596564ee506a1d6a432a |
Close
Hashes for redis_rs-0.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57cef257f7cf24be2d91aa33d9d99a733096310fa1f9ea3a8cb729cac9dfbb2d |
|
MD5 | 2fcb303e8b65f0833a1f3f229ce72eee |
|
BLAKE2b-256 | 7393a4cc95822e87cf783efdb95704b16085bbc1fc330f62b7344fcfe01d9e1d |