synaptic_sqlite/lib.rs
1//! SQLite integration for the Synaptic framework.
2//!
3//! This crate provides [`SqliteCache`], a SQLite-backed implementation of the
4//! [`LlmCache`](synaptic_core::LlmCache) trait for caching LLM responses with
5//! optional TTL expiration.
6//!
7//! # Quick start
8//!
9//! ```rust,no_run
10//! use synaptic_sqlite::{SqliteCache, SqliteCacheConfig};
11//!
12//! # fn example() -> Result<(), Box<dyn std::error::Error>> {
13//! // In-memory cache (great for testing)
14//! let cache = SqliteCache::new(SqliteCacheConfig::in_memory())?;
15//!
16//! // File-based cache with 1-hour TTL
17//! let config = SqliteCacheConfig::new("/tmp/llm_cache.db").with_ttl(3600);
18//! let cache = SqliteCache::new(config)?;
19//! # Ok(())
20//! # }
21//! ```
22
23mod cache;
24
25pub use cache::{SqliteCache, SqliteCacheConfig};
26
27// Re-export core traits for convenience.
28pub use synaptic_core::{ChatResponse, LlmCache};