adapter
Module[Adapter]: where a cache keeps its entries, and the dynamic form
DynAdapter for adapters chosen at run time.
Contents
use utopia_cache::Retry;pub struct RetryRetries of a networked adapter: how many times a command that failed on the connection is retried, and the pause between attempts.
Default.use utopia_cache::Adapter;pub trait Adapter: Send + SyncA cache backend.
Entries live under a key; adapters that store hashes keep several
fields under one key, chosen by hash (an empty or "0" hash means the
key itself). A load misses (None) when the entry is absent or older than
its ttl. Implement it to add a backend; the optional capabilities
(batches of fields, leases, telemetry) have defaults that behave like an
adapter without them.
use utopia_cache::DynAdapter;pub trait DynAdapter: Send + SyncThe object-safe form of Adapter, implemented for every adapter, so
adapters of different types can share a Vec<Arc<dyn DynAdapter>> (and
dyn DynAdapter is itself an Adapter).
pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>A boxed future, for DynAdapter.
pub type Fields = IndexMap<String, Value>Fields of a hash and their values, in order.