Skip to main content

CacheTier

Struct CacheTier 

Source
pub struct CacheTier<K, V, P: EvictionPolicy = DefaultEvictionPolicy, const CAPACITY: usize = 0, const WAYS: usize = 8> { /* private fields */ }
Expand description

Represents a single cache tier (e.g., T0, T1, T2) using Set-Associative Lock-Free arrays.

Implementations§

Source§

impl<K, V, P: EvictionPolicy, const CAPACITY: usize, const WAYS: usize> CacheTier<K, V, P, CAPACITY, WAYS>

Source

pub const fn new(policy: P) -> Self

Create a new CacheTier.

Source

pub fn get_set(&self, hash: usize) -> &[Slot<K, V>]

Retrieve the set of slots for a given hash.

Source

pub fn fetch_hint<const N: usize>( &self, hash: usize, arena: &Arena<K, V, N>, guard: &Guard, ) -> Option<(K, V)>
where K: Clone, V: Clone,

Touch a slot by hash to prevent it from being evicted (Prefetch hint)

Source

pub fn get_slot<const N: usize>( &self, arena: &Arena<K, V, N>, hash: usize, key: &K, guard: &Guard, ) -> Option<&Slot<K, V>>
where K: PartialEq,

Retrieve a slot if the key exists in this tier.

Source

pub fn insert<const N: usize>( &self, arena: &Arena<K, V, N>, hash: usize, key: K, value: V, node: *mut ThreadStateNode, )
where K: PartialEq,

Insert a key and value into the tier using the provided eviction policy.

Trait Implementations§

Source§

impl<K, V, const CAPACITY: usize, const WAYS: usize> Default for CacheTier<K, V, DefaultEvictionPolicy, CAPACITY, WAYS>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<K, V, P = DefaultEvictionPolicy, const CAPACITY: usize = 0, const WAYS: usize = 8> !Freeze for CacheTier<K, V, P, CAPACITY, WAYS>

§

impl<K, V, P, const CAPACITY: usize, const WAYS: usize> RefUnwindSafe for CacheTier<K, V, P, CAPACITY, WAYS>

§

impl<K, V, P, const CAPACITY: usize, const WAYS: usize> Send for CacheTier<K, V, P, CAPACITY, WAYS>
where K: Send, V: Send,

§

impl<K, V, P, const CAPACITY: usize, const WAYS: usize> Sync for CacheTier<K, V, P, CAPACITY, WAYS>
where K: Sync, V: Sync,

§

impl<K, V, P, const CAPACITY: usize, const WAYS: usize> Unpin for CacheTier<K, V, P, CAPACITY, WAYS>
where P: Unpin, K: Unpin, V: Unpin,

§

impl<K, V, P, const CAPACITY: usize, const WAYS: usize> UnsafeUnpin for CacheTier<K, V, P, CAPACITY, WAYS>
where P: UnsafeUnpin,

§

impl<K, V, P, const CAPACITY: usize, const WAYS: usize> UnwindSafe for CacheTier<K, V, P, CAPACITY, WAYS>
where P: UnwindSafe, K: UnwindSafe, V: UnwindSafe,

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.