Skip to main content

DualCacheFF

Struct DualCacheFF 

Source
pub struct DualCacheFF<K, V, P, const CAP2: usize, const CAP1: usize, const CAP0: usize, const TOTAL_CAP: usize, const MAX_THREADS: usize, const TLS_CAP: usize, const TLS_INDEX_CAP: usize>
where P: CachePolicy + Send + Sync,
{ pub daemon_mode: AtomicBool, pub cata_mode: AtomicBool, pub tls_registry: TlsRegistry<K, V, MAX_THREADS, TLS_CAP, TLS_INDEX_CAP>, pub global_tx: RwLock<Option<Arc<BoundedQueue<DaemonMessage<K, V>, 65536>>>>, pub daemon_handle: RwLock<Option<Daemon>>, /* private fields */ }
Expand description

DualCacheFF is the main entry point for the cache, providing standard API operations and managing the background daemon for garbage collection and memory reclamation.

Fields§

§daemon_mode: AtomicBool§cata_mode: AtomicBool§tls_registry: TlsRegistry<K, V, MAX_THREADS, TLS_CAP, TLS_INDEX_CAP>§global_tx: RwLock<Option<Arc<BoundedQueue<DaemonMessage<K, V>, 65536>>>>§daemon_handle: RwLock<Option<Daemon>>

Implementations§

Source§

impl<K, V, P, const CAP2: usize, const CAP1: usize, const CAP0: usize, const TOTAL_CAP: usize, const MAX_THREADS: usize, const TLS_CAP: usize, const TLS_INDEX_CAP: usize> DualCacheFF<K, V, P, CAP2, CAP1, CAP0, TOTAL_CAP, MAX_THREADS, TLS_CAP, TLS_INDEX_CAP>
where K: Clone + Eq + Hash + Send + Sync + 'static, V: Clone + Send + Sync + 'static, P: CachePolicy + Send + Sync + 'static,

Source

pub const fn new(eviction: P::Evict) -> Self

Source

pub fn set_cata_tuning(&'static self, on: bool)

Start the CATA-DC Demiurge tuning engine in the background

Source

pub fn set_daemon_mode(&'static self, on: bool)

Turn the Daemon on or off. If turned on, a new daemon thread is automatically spawned and channel is established.

Source

pub fn register_thread(&self) -> TlsHandle

Register the current thread to get a fast TLS handle.

Source

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

Source

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

Source

pub fn warmup(&self, key: K, value: V, handle: &TlsHandle)

Insert a key-value pair directly as a high-priority “genius” item. This bypasses normal promotion and pins the item directly in the hottest tier (T0). Equivalent to ‘insert_t1’ or ‘warmup’ from v0.4.0.

Source§

impl<K, V, P, const CAP2: usize, const CAP1: usize, const CAP0: usize, const TOTAL_CAP: usize, const MAX_THREADS: usize, const TLS_CAP: usize, const TLS_INDEX_CAP: usize> DualCacheFF<K, V, P, CAP2, CAP1, CAP0, TOTAL_CAP, MAX_THREADS, TLS_CAP, TLS_INDEX_CAP>
where K: Clone + Eq, V: Clone, P: CachePolicy + Send + Sync,

Source

pub fn get_metrics(&self) -> (u64, u64)

Trait Implementations§

Source§

impl<K, V, P, const CAP2: usize, const CAP1: usize, const CAP0: usize, const TOTAL_CAP: usize, const MAX_THREADS: usize, const TLS_CAP: usize, const TLS_INDEX_CAP: usize> Default for DualCacheFF<K, V, P, CAP2, CAP1, CAP0, TOTAL_CAP, MAX_THREADS, TLS_CAP, TLS_INDEX_CAP>
where K: Clone + Eq + Hash + Send + Sync + 'static, V: Clone + Send + Sync + 'static, P: CachePolicy + Send + Sync + 'static,

Available on crate feature std only.
Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<K, V, P, const T0_CAP: usize, const T1_CAP: usize, const T2_CAP: usize, const TOTAL_CAP: usize, const MAX_THREADS: usize, const TLS_CAP: usize, const TLS_INDEX_CAP: usize> Drop for DualCacheFF<K, V, P, T0_CAP, T1_CAP, T2_CAP, TOTAL_CAP, MAX_THREADS, TLS_CAP, TLS_INDEX_CAP>
where P: CachePolicy + Send + Sync,

Available on crate feature std only.
Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<K, V, P, const CAP2: usize, const CAP1: usize, const CAP0: usize, const TOTAL_CAP: usize, const MAX_THREADS: usize, const TLS_CAP: usize, const TLS_INDEX_CAP: usize> Send for DualCacheFF<K, V, P, CAP2, CAP1, CAP0, TOTAL_CAP, MAX_THREADS, TLS_CAP, TLS_INDEX_CAP>
where P: CachePolicy + Send + Sync,

Available on crate feature std only.
Source§

impl<K, V, P, const CAP2: usize, const CAP1: usize, const CAP0: usize, const TOTAL_CAP: usize, const MAX_THREADS: usize, const TLS_CAP: usize, const TLS_INDEX_CAP: usize> Sync for DualCacheFF<K, V, P, CAP2, CAP1, CAP0, TOTAL_CAP, MAX_THREADS, TLS_CAP, TLS_INDEX_CAP>
where P: CachePolicy + Send + Sync,

Available on crate feature std only.

Auto Trait Implementations§

§

impl<K, V, P, const CAP2: usize, const CAP1: usize, const CAP0: usize, const TOTAL_CAP: usize, const MAX_THREADS: usize, const TLS_CAP: usize, const TLS_INDEX_CAP: usize> !Freeze for DualCacheFF<K, V, P, CAP2, CAP1, CAP0, TOTAL_CAP, MAX_THREADS, TLS_CAP, TLS_INDEX_CAP>

§

impl<K, V, P, const CAP2: usize, const CAP1: usize, const CAP0: usize, const TOTAL_CAP: usize, const MAX_THREADS: usize, const TLS_CAP: usize, const TLS_INDEX_CAP: usize> !RefUnwindSafe for DualCacheFF<K, V, P, CAP2, CAP1, CAP0, TOTAL_CAP, MAX_THREADS, TLS_CAP, TLS_INDEX_CAP>

§

impl<K, V, P, const CAP2: usize, const CAP1: usize, const CAP0: usize, const TOTAL_CAP: usize, const MAX_THREADS: usize, const TLS_CAP: usize, const TLS_INDEX_CAP: usize> !UnwindSafe for DualCacheFF<K, V, P, CAP2, CAP1, CAP0, TOTAL_CAP, MAX_THREADS, TLS_CAP, TLS_INDEX_CAP>

§

impl<K, V, P, const CAP2: usize, const CAP1: usize, const CAP0: usize, const TOTAL_CAP: usize, const MAX_THREADS: usize, const TLS_CAP: usize, const TLS_INDEX_CAP: usize> Unpin for DualCacheFF<K, V, P, CAP2, CAP1, CAP0, TOTAL_CAP, MAX_THREADS, TLS_CAP, TLS_INDEX_CAP>
where <P as CachePolicy>::Evict: Unpin, P: Unpin, K: Unpin, V: Unpin,

§

impl<K, V, P, const CAP2: usize, const CAP1: usize, const CAP0: usize, const TOTAL_CAP: usize, const MAX_THREADS: usize, const TLS_CAP: usize, const TLS_INDEX_CAP: usize> UnsafeUnpin for DualCacheFF<K, V, P, CAP2, CAP1, CAP0, TOTAL_CAP, MAX_THREADS, TLS_CAP, TLS_INDEX_CAP>

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
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> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.