Skip to main content

StaticDualCache

Struct StaticDualCache 

Source
pub struct StaticDualCache<K, V, S = RandomState> {
    pub hasher: S,
    pub t1: Arc<T1<K, V>>,
    pub t2: Arc<T2<K, V>>,
    pub cache: Arc<Cache<K, V>>,
    pub epoch: Arc<AtomicU32>,
    pub worker_states: Arc<[WorkerState]>,
    /* private fields */
}
Expand description

A synchronous, wait-free read / spin-locked write cache interface. Serves as the standard no_std fallback when background Daemon processing is undesirable.

Fields§

§hasher: S§t1: Arc<T1<K, V>>§t2: Arc<T2<K, V>>§cache: Arc<Cache<K, V>>§epoch: Arc<AtomicU32>§worker_states: Arc<[WorkerState]>

Implementations§

Source§

impl<K, V> StaticDualCache<K, V, RandomState>
where K: Hash + Eq + Send + Sync + Clone + 'static, V: Send + Sync + Clone + 'static,

Source

pub fn new(config: Config) -> Self

Source

pub fn new_headless(config: Config) -> (Self, ())

Source§

impl<K, V, S> StaticDualCache<K, V, S>
where K: Hash + Eq + Send + Sync + Clone + 'static, V: Send + Sync + Clone + 'static, S: BuildHasher + Clone + Send + 'static,

Source

pub fn with_hasher(config: Config, hasher: S) -> Self

Source

pub fn get(&self, key: &K) -> Option<V>

Read operations are fully Lock-Free.

Source

pub fn insert(&self, key: K, value: V)

Insert synchronously acquires the lock and updates the core.

Source

pub fn insert_t1(&self, key: K, value: V)

Source

pub fn remove(&self, key: &K)

Source

pub fn maintenance(&self)

Source

pub fn clear(&self)

Trait Implementations§

Source§

impl<K: Send, V: Send, S: Send> Send for StaticDualCache<K, V, S>

Source§

impl<K: Sync, V: Sync, S: Sync> Sync for StaticDualCache<K, V, S>

Auto Trait Implementations§

§

impl<K, V, S = RandomState> !Freeze for StaticDualCache<K, V, S>

§

impl<K, V, S = RandomState> !RefUnwindSafe for StaticDualCache<K, V, S>

§

impl<K, V, S> Unpin for StaticDualCache<K, V, S>
where S: Unpin,

§

impl<K, V, S> UnsafeUnpin for StaticDualCache<K, V, S>
where S: UnsafeUnpin,

§

impl<K, V, S> UnwindSafe for StaticDualCache<K, V, S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.