blazen-memory-valkey 0.5.4

Valkey/Redis backend for blazen-memory
Documentation

blazen-memory-valkey

A Valkey/Redis backend for [blazen-memory].

This crate provides [ValkeyBackend], an implementation of MemoryBackend that persists entries in Valkey (or Redis-compatible) using the following key layout:

Key pattern Type Contents
{prefix}entry:{id} STRING JSON-serialized StoredEntry
{prefix}bands:{band_value} SET Entry IDs sharing this LSH band
{prefix}ids SET All entry IDs

Quick start

use blazen_memory_valkey::ValkeyBackend;
use blazen_memory::{Memory, MemoryStore, MemoryEntry};

# async fn example() -> blazen_memory::error::Result<()> {
let backend = ValkeyBackend::new("redis://localhost:6379")
    .expect("failed to create Valkey client");

let memory = Memory::local(backend);
memory.add(vec![MemoryEntry::new("hello world")]).await?;
# Ok(())
# }

Features

  • redis-tcp (default): native TCP [ValkeyBackend] using the redis crate. Does not compile on wasm32-wasip1* targets.
  • upstash: wasi-compatible [UpstashBackend] that talks to Upstash's Redis REST API via [blazen_llm::http::HttpClient].