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.8.0.tar.gz
(28.4 kB
view hashes)
Built Distributions
Close
Hashes for redis_rs-0.8.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f17e89521d24efff8208d5d3022f996c7494a125cf1b95537b7c4ec5e8725c46 |
|
MD5 | 0f8c0945d1dea92abbcbe6719a0e5e6f |
|
BLAKE2b-256 | cd413f91883dff8383b26243d1db15add1bea6dca74c309ca55e07cd91008356 |
Close
Hashes for redis_rs-0.8.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 487877ae7366a5d98fdcb232b051e9d8d05d55af1b1f914963391d77255d25cf |
|
MD5 | bf7b08ba826afadbefddfde0f7154a52 |
|
BLAKE2b-256 | 9b98c55781480bb8accbdf5e5eaf49f0558d1599b55d3290102ee110cbd96d60 |
Close
Hashes for redis_rs-0.8.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61bc2f748b961bd289ad34b628041f592752d8b26ca3e980c7be50da0d4eecbb |
|
MD5 | 9598cce76e6faed532bc004d9f303700 |
|
BLAKE2b-256 | c2ac6da38c19279c992bf50e08a36d1acf52d52359bad1a9557fb02a50564c56 |
Close
Hashes for redis_rs-0.8.0-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18c3bbffa55c4bbf002544ab0c01cc4afc45b368144a9e885e7b6cfdd6fa35c8 |
|
MD5 | 729e00558ca0ba5596ca41b58cf8c59c |
|
BLAKE2b-256 | b2bcfda4b77d98981445e2cc2e3d2b958ab8145f34f73b6ca7417246a684dfbe |
Close
Hashes for redis_rs-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1eb128dba5459c2180ddef5609ab9d14cdcbcbe33721bed86e3eb4a883a7a3c |
|
MD5 | 8fa982950f32ae7cd4536e9e04d0d109 |
|
BLAKE2b-256 | 025d5989e75516a6bfb02750af9672b24e4e03925bb77eda024240ba77ac3dd8 |
Close
Hashes for redis_rs-0.8.0-cp312-cp312-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe6b9ffc8028484366c824261857d18e92766b5f131eb55028e46758f4a00d64 |
|
MD5 | 092f60d0bb676211a231e838a3e33550 |
|
BLAKE2b-256 | 4966c36d01eddc41f755395f7d55690b62a1c79499666666faa0157686942571 |
Close
Hashes for redis_rs-0.8.0-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 337ed5e462e0bcec426aa8766b61eaede6592edb62256618b4c4e7178631ab62 |
|
MD5 | b9d5d0983d111c5bbc930547fb52cdce |
|
BLAKE2b-256 | 41552e9c372a5c15aa7382efd25d615fe256f0eb59cdfec33da66cb705e6d65a |
Close
Hashes for redis_rs-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 216f922a147cccb9176ec5ac9ad02d2514c84b56aeedd2e2112b6c06dea4af59 |
|
MD5 | 92e682bc1079886e583499f6a56ddcd0 |
|
BLAKE2b-256 | 2599093f3f8e2a13cca2a2a880b0d99329ff6fc77e7ae32cb37581d826787aea |
Close
Hashes for redis_rs-0.8.0-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6faf9654aef2ed08099e45fa1079ef74b3d1b17a823382ca2b1fbb3d22a70f2a |
|
MD5 | 532786b813a66f7f5a409aff9a00dc6e |
|
BLAKE2b-256 | 722fd48444b2d4d9d157ca799b83e2651072cb41ecdc23e4a8c831239f1b0006 |
Close
Hashes for redis_rs-0.8.0-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d685650c99222e77e643cbc0715b5b627c9e4fe4dc9426eb2cb94c8b5c6c45e6 |
|
MD5 | 1a43bf38a769631e93fd3ea1dbb9f66f |
|
BLAKE2b-256 | ba5b1a0a088c0044e9654c04b5014fe584fe6d65d91431e35195ab328f276462 |
Close
Hashes for redis_rs-0.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2b98ef1b2ed126981f900133df331841d31700a2b9b118633cf8cb7acbb3d2b |
|
MD5 | 49bc30dede891a96aab50b9af2b25ecc |
|
BLAKE2b-256 | 8e58c0a3fb8ba59a91a2e284a736e001d1d668a3b8f881ecad68fe7c85f95b13 |
Close
Hashes for redis_rs-0.8.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1662b21ed5e566c34c320b0cecf868ae8e5cd34f1b0e250894313a87126910bf |
|
MD5 | d44d367e12ca1e54999a9205cd516829 |
|
BLAKE2b-256 | 6ac9f096ca3e6e81207c76c34beebda19729fb711c2dd10862454cfa67ed7f2f |
Close
Hashes for redis_rs-0.8.0-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6a6e6390a12150b209fa6bcbcad06efe6dd0ad5219058da5ed61cca4338bf61 |
|
MD5 | 06f48aa97760b4d7b6ac334fd9c21e69 |
|
BLAKE2b-256 | 9d2eae651b49b62393addc0fe905580181db2a663e2533815038b94ac2d15d3e |
Close
Hashes for redis_rs-0.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0889900f81d053ab8d2ede445483df5431ca58f53d0da023e07d209af4dcbabd |
|
MD5 | 6791f435321234e1ba3ed8ae542b3b02 |
|
BLAKE2b-256 | 5a3ecc81e4c1dd2fce2525d65f011cf412d6908498ee5a9775bd01183c449f10 |
Close
Hashes for redis_rs-0.8.0-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eab5c6a4269dab83d3e809a597f71b450798cb5d8c7870f74fbdadea95572a3f |
|
MD5 | adcd46e058c1310cb829780f00f78df1 |
|
BLAKE2b-256 | 71dadac33a230c1a4702a94a0799daa955fcf81ff2342986d375028cdb91d144 |
Close
Hashes for redis_rs-0.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f658e969d0474001479ecb788788f4f57e71dc662f91073e68ed49d3a725e232 |
|
MD5 | 07759c8a2827423506f09778bed8cc0d |
|
BLAKE2b-256 | 86080be99acd89ce92513c0c6097d241acfb35c958acf58277849fff3dc3030e |