Trait FileCache
Source pub trait FileCache<V> {
// Required methods
fn get(&self, key: &str) -> Result<Option<V>>;
fn get_stale(&self, key: &str) -> Result<Option<V>>;
fn set(&self, key: &str, value: &V) -> Result<()>;
fn remove(&self, key: &str) -> Result<()>;
}
Expand description
Trait for TTL-based filesystem caching.
Provides a unified interface for caching serializable data with time-to-live validation.
Get a cached value if it exists and is valid.
§Arguments
key - Cache key (filename without extension)
§Returns
The cached value if it exists and is within TTL, None otherwise.
Get a cached value regardless of TTL (stale fallback).
§Arguments
key - Cache key (filename without extension)
§Returns
The cached value if it exists, None otherwise.
Set a cached value.
§Arguments
key - Cache key (filename without extension)
value - Value to cache
Remove a cached value.
§Arguments
key - Cache key (filename without extension)