ceylon_runtime/memory/mod.rs
1//! Memory backends for agent state persistence.
2//!
3//! This module provides pluggable storage backends implementing the [`crate::core::memory::Memory`] trait:
4//!
5//! - [`InMemoryBackend`] - Fast, thread-safe in-memory storage (default)
6//! - [`SqliteBackend`] - File-based persistent storage (feature: `sqlite`)
7//! - [`RedisBackend`] - Distributed persistent storage (feature: `redis`)
8//!
9//! # Example
10//!
11//! ```rust,no_run
12//! use ceylon_runtime::InMemoryBackend;
13//! use ceylon_runtime::core::memory::{Memory, MemoryEntry, MemoryQuery};
14//!
15//! # async fn example() -> anyhow::Result<()> {
16//! let memory = InMemoryBackend::new();
17//!
18//! // Store an entry
19//! let entry = MemoryEntry::new("Important note");
20//! let id = memory.store(entry).await?;
21//!
22//! // Retrieve by ID
23//! if let Some(entry) = memory.get(&id).await? {
24//! println!("Content: {}", entry.content);
25//! }
26//! # Ok(())
27//! # }
28//! ```
29//!
30//! See the [Memory Backends README](../../../docs/runtime/memory-backends.md)
31//! for detailed documentation on each backend.
32
33pub mod backends;
34
35pub use backends::in_memory::InMemoryBackend;
36
37#[cfg(feature = "sqlite")]
38pub use backends::sqlite::SqliteBackend;
39
40#[cfg(feature = "redis")]
41pub use backends::redis::RedisBackend;