Skip to main content

FirestoreMemoryCache

Type Alias FirestoreMemoryCache 

Source
pub type FirestoreMemoryCache = FirestoreCache<FirestoreMemoryCacheBackend, FirestoreMemListenStateStorage>;
Expand description

Re-exports all public items from the cache module.

This is only available if the caching feature is enabled. It includes types like FirestoreCache and various caching backends and configurations. A ready-to-use in-memory cache.

Use this alias to store a cache in your own types without spelling out its generic parameters:

struct AppState {
    db: FirestoreDb,
    cache: std::sync::Arc<FirestoreMemoryCache>,
}

Aliased Type§

pub struct FirestoreMemoryCache { /* private fields */ }

Implementations§

Source§

impl FirestoreMemoryCache

Source

pub fn memory( db: &FirestoreDb, ) -> FirestoreCacheBuilder<FirestoreMemoryCacheKind>

Starts building an in-memory cache.

let cache = FirestoreCache::memory(db)
    .preloaded_collection("countries")
    .build()
    .await?;

let country: Option<String> = db
    .read_through_cache(&cache)
    .fluent()
    .select()
    .by_id_in("countries")
    .obj()
    .one("SE")
    .await?;
Source

pub fn builder( db: &FirestoreDb, ) -> FirestoreCacheBuilder<FirestoreMemoryCacheKind>

Starts building an in-memory cache. Equivalent to FirestoreCache::memory.