Expand description
In-memory storage utilities for WASM-compatible caching.
This module provides a generic MemoryStore that can be used to cache
data in memory, particularly useful for WASM environments where filesystem
access is limited or unavailable.
§Example
use rh_foundation::memory::{MemoryStore, MemoryStoreConfig};
// Create a store with default config
let store: MemoryStore<String> = MemoryStore::new(MemoryStoreConfig::default());
// Insert and retrieve values
store.insert("key1".to_string(), "value1".to_string());
assert_eq!(store.get(&"key1".to_string()), Some("value1".to_string()));
// Check if key exists
assert!(store.contains(&"key1".to_string()));
// Remove a value
store.remove(&"key1".to_string());
assert!(!store.contains(&"key1".to_string()));Structs§
- Memory
Store - A thread-safe in-memory key-value store.
- Memory
Store Config - Configuration for a memory store.
- Memory
Store Stats - Statistics for a memory store.