moka/
sync.rs

1//! Provides thread-safe, concurrent cache implementations.
2
3mod base_cache;
4mod builder;
5mod cache;
6mod entry_selector;
7mod invalidator;
8mod key_lock;
9mod segment;
10mod value_initializer;
11
12/// The type of the unique ID to identify a predicate used by
13/// [`Cache::invalidate_entries_if`][invalidate-if] method.
14///
15/// A `PredicateId` is a `String` of UUID (version 4).
16///
17/// [invalidate-if]: ./struct.Cache.html#method.invalidate_entries_if
18pub type PredicateId = String;
19
20pub(crate) type PredicateIdStr<'a> = &'a str;
21
22pub use crate::common::iter::Iter;
23pub use {
24    builder::CacheBuilder,
25    cache::Cache,
26    entry_selector::{OwnedKeyEntrySelector, RefKeyEntrySelector},
27    segment::SegmentedCache,
28};
29
30/// Provides extra methods that will be useful for testing.
31pub trait ConcurrentCacheExt<K, V> {
32    /// Performs any pending maintenance operations needed by the cache.
33    fn sync(&self);
34}
35
36// Empty struct to be used in `InitResult::InitErr` to represent the Option None.
37pub(crate) struct OptionallyNone;
38
39// Empty struct to be used in `InitResult::InitErr`` to represent the Compute None.
40pub(crate) struct ComputeNone;