Skip to main content

Crate redis_tower_modules

Crate redis_tower_modules 

Source
Expand description

High-level, ergonomic client interfaces for Redis Stack modules.

This crate is the dedicated home for typed, ergonomic clients over the Redis Stack modules (RedisJSON, RediSearch, RedisTimeSeries, the probabilistic data structures, and Vector Sets). Callers never see raw Frame values or command structs; they work with typed Rust values, with serialization and response parsing handled inside each client.

The lower-level command builders live in redis-tower-commands, and the redis-tower crate exposes the connections and middleware these clients wrap. This crate sits on top, trading a little flexibility for a much friendlier surface.

§Feature flags

Each module client is gated behind a feature flag. The full feature (enabled by default) turns them all on.

FeatureEnables
jsonjson::JsonClient — RedisJSON
searchsearch::SearchClient — RediSearch
timeseriestimeseries::TimeSeriesClient — RedisTimeSeries
probabilisticBloom, Cuckoo, Count-Min Sketch, TopK, T-Digest clients
vectorvector::VectorSetClient — Vector Sets
fullAll of the above (default)

§Quick start

use redis_tower::RedisClient;
use redis_tower_modules::json::JsonClient;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
struct User {
    name: String,
    age: u32,
}

let client = RedisClient::connect_url("redis://127.0.0.1:6379").await?;
let mut json = JsonClient::new(client);

let user = User { name: "Ada".into(), age: 36 };
json.set("user:1", "$", &user).await?;

let fetched: Option<User> = json.get("user:1", "$").await?;
assert_eq!(fetched.expect("user:1 was just written").name, "Ada");

§Binary data

Module keys, Bloom/Cuckoo/sketch items, Search suggestions and payloads, TimeSeries labels, and Vector Set elements accept binary-safe CommandArg inputs. Corresponding opaque response positions use bytes::Bytes. JSONPath, serialized JSON, Search query/schema syntax, timestamps, and Vector Set filter expressions remain structured text or numeric inputs.

Modules§

jsonjson
JSON Client
probabilisticprobabilistic
Probabilistic Data Structures
searchsearch
Search Client
timeseriestimeseries
TimeSeries Client
vectorvector
Vector Set Client