Skip to main content

build_memory_cache

Function build_memory_cache 

Source
pub fn build_memory_cache<K, V>(config: &CacheConfig) -> Cache<K, V>
where K: Hash + Eq + Send + Sync + 'static, V: Clone + Send + Sync + 'static,
Expand description

Build an in-memory cache whose capacity and default TTL come from config (max_entries and default_ttl_secs).

The backend field is not enforced here — this is the in-memory path by construction — so it can also back a Redis-configured service in tests or as a local fallback. The key/value types are chosen by the caller.