Module cache

Module cache 

Source
Expand description

§Cache Management for dioxus-provider

This module implements a global, type-erased cache for provider results, supporting:

  • Expiration: Entries are removed after a configurable TTL.
  • Staleness (SWR): Entries can be marked stale and revalidated in the background.
  • LRU Eviction: Least-recently-used entries are evicted to maintain a size limit.
  • Access/Usage Stats: Provides statistics for cache introspection and tuning.

§Example

use dioxus_provider::cache::ProviderCache;
let cache = ProviderCache::new();
cache.set("my_key".to_string(), 42);
let value: Option<i32> = cache.get("my_key");

Cache management and async state types for dioxus-provider

Structs§

CacheEntry
A type-erased cache entry for storing provider results with timestamp and access tracking
CacheGetOptions
Options for cache retrieval operations
CacheGetResult
Result type for cache get operations with staleness information
CacheMaintenanceStats
Statistics for cache maintenance operations
CacheStats
General cache statistics
ProviderCache
Global cache for provider results with automatic cleanup