Skip to main content

use_client_cache

Function use_client_cache 

Source
pub fn use_client_cache(config: CacheConfig)
Expand description

Sets up the client cache. Call once, at the top of the app’s root component, before any cached read.

ⓘ
fn App() -> Element {
    g3_cache::use_client_cache(g3_cache::CacheConfig::new("media-mancer"));
    // ...
}

Without it, reads are still cached with default settings, but a store named g3-cache is shared with any other g3 app on the same origin, and nothing refetches on focus.

Persisting reads to disk also needs set_cache_owner: until the app has said whose data this is, the cache keeps everything in memory only.