whatsapp_rust/cache.rs
1//! The client's in-process cache type.
2//!
3//! Backed by [`PortableCache`](crate::portable_cache::PortableCache): a
4//! runtime-agnostic cache (capacity + TTL/TTI eviction, single-flight
5//! `get_with`) that builds on every target, including wasm32.
6
7pub use crate::portable_cache::PortableCache as Cache;
8
9/// Selects whether an operation may use an existing snapshot or must refresh it
10/// from its authoritative source before returning.
11#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
12#[non_exhaustive]
13pub enum Freshness {
14 /// Return a cached snapshot when available and consult the source on a miss.
15 #[default]
16 CachePreferred,
17 /// Consult the source and publish the resulting snapshot without clearing the
18 /// previous one first.
19 Refresh,
20}