Expand description
§Rullst Cache System (rullst::cache)
Provides a unified caching API with pluggable drivers.
§Drivers
- In-Memory (default):
DashMap-based concurrent store with TTL support. Zero config. - Redis (optional): Requires the
cache-redisfeature flag.
§Quick Start
ⓘ
use rullst::cache::Cache;
let cache = Cache::memory();
// Store a value with 60-second TTL
cache.put("user:42:name", "Alice", Some(60)).await?;
// Retrieve it
let name = cache.get("user:42:name").await?; // Some("Alice")
// Cache-aside pattern: fetch from cache or compute + store
let value = cache.remember("expensive_key", 300, || async {
Ok("computed_value".to_string())
}).await?;Structs§
- Cache
- The main cache facade for storing and retrieving cached values.
- Memory
Driver - In-memory cache driver using
DashMapfor lock-free concurrent access.
Enums§
- Cache
Error - Errors that can occur during cache operations.
Traits§
- Cache
Driver - Abstraction over cache storage backends.