synaptic_redis/lib.rs
1//! Redis integration for the Synaptic framework.
2//!
3//! This crate provides two Redis-backed implementations:
4//!
5//! - [`RedisStore`] — implements the [`Store`](synaptic_core::Store) trait for
6//! persistent key-value storage with namespace support.
7//! - [`RedisCache`] — implements the [`LlmCache`](synaptic_core::LlmCache) trait
8//! for caching LLM responses with optional TTL expiration.
9//!
10//! # Quick start
11//!
12//! ```rust,no_run
13//! use synaptic_redis::{RedisStore, RedisStoreConfig, RedisCache, RedisCacheConfig};
14//!
15//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
16//! // Store
17//! let store = RedisStore::from_url("redis://127.0.0.1/")?;
18//!
19//! // Cache with 1-hour TTL
20//! let config = RedisCacheConfig { ttl: Some(3600), ..Default::default() };
21//! let cache = RedisCache::from_url_with_config("redis://127.0.0.1/", config)?;
22//! # Ok(())
23//! # }
24//! ```
25
26mod cache;
27mod store;
28
29pub use cache::{RedisCache, RedisCacheConfig};
30pub use store::{RedisStore, RedisStoreConfig};
31
32// Re-export core traits for convenience.
33pub use synaptic_core::{ChatResponse, Item, LlmCache, Store};