Expand description
§not_redis
A Redis-compatible in-memory data structure library for Rust.
not_redis provides Redis-like APIs without the networking overhead, external service dependencies, or operational complexity of running a Redis server.
§Features
- Zero-config: Embeddable Redis-compatible storage
- Thread-safe: Concurrent access via Tokio and DashMap
- RESP-compatible: Data types and command semantics compatible with Redis
- In-process: No network overhead - runs in your application
§Supported Commands
- Strings: GET, SET, DEL, EXISTS, EXPIRE, TTL, PERSIST
- Hashes: HSET, HGET, HGETALL, HDEL
- Lists: LPUSH, RPUSH, LLEN
- Sets: SADD, SMEMBERS
- Utilities: PING, ECHO, DBSIZE, FLUSHDB
§Example
use not_redis::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = Client::new();
client.start().await;
// String operations
client.set("user:1:name", "Alice").await?;
let name: String = client.get("user:1:name").await?;
// Hash operations
client.hset("user:1", "email", "alice@example.com").await?;
let email: String = client.hget("user:1", "email").await?;
// Expiration
client.expire("user:1", 60).await?;
let ttl: i64 = client.ttl("user:1").await?;
Ok(())
}Structs§
- Client
- A Redis client for executing commands against an in-memory store.
- Storage
Engine - The core storage engine for the Redis-like store.
- Stored
Value - A value stored in the storage engine with optional expiration.
Enums§
- Redis
Data - Internal data types stored in the engine.
- Redis
Error - Error type for Redis operations.
- Value
- Represents a value stored in or returned from Redis.
Traits§
- From
Redis Value - A trait for converting Redis values into Rust types.
- ToRedis
Args - A trait for converting values into Redis command arguments.
Type Aliases§
- Redis
Result - A specialized
Resulttype for Redis operations. - Stream
Entry - Represents a single entry in a Redis stream.