Skip to main content

Crate blazen_memory_valkey

Crate blazen_memory_valkey 

Source
Expand description

§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 patternTypeContents
{prefix}entry:{id}STRINGJSON-serialized StoredEntry
{prefix}bands:{band_value}SETEntry IDs sharing this LSH band
{prefix}idsSETAll entry IDs

§Quick start

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

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?;

§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].

Structs§

ValkeyBackend
A MemoryBackend implementation backed by Valkey (or any Redis-compatible server).