pub struct FoyerMemoryCache { /* private fields */ }Expand description
foyer-backed in-memory lookup table cache.
Wraps [foyer::Cache] with hit/miss counters and lookup-table
semantics. Designed for Ring 0 (< 500ns per operation).
§Thread safety
foyer::Cache is internally sharded and lock-free on the read path.
FoyerMemoryCache is Send + Sync.
Implementations§
Source§impl FoyerMemoryCache
impl FoyerMemoryCache
Sourcepub fn new(table_id: u32, config: FoyerMemoryCacheConfig) -> Self
pub fn new(table_id: u32, config: FoyerMemoryCacheConfig) -> Self
Create a new cache with the given configuration.
Sourcepub fn with_defaults(table_id: u32) -> Self
pub fn with_defaults(table_id: u32) -> Self
Create a cache with default configuration.
Sourcepub fn miss_count(&self) -> u64
pub fn miss_count(&self) -> u64
Total cache misses since creation.
Trait Implementations§
Source§impl Debug for FoyerMemoryCache
impl Debug for FoyerMemoryCache
Source§impl LookupTable for FoyerMemoryCache
impl LookupTable for FoyerMemoryCache
Source§fn get_cached(&self, key: &[u8]) -> LookupResult
fn get_cached(&self, key: &[u8]) -> LookupResult
Look up a key in the in-memory cache only (Ring 0). Read more
Source§fn get(&self, key: &[u8]) -> LookupResult
fn get(&self, key: &[u8]) -> LookupResult
Look up a key, potentially checking slower storage tiers. Read more
Source§fn invalidate(&self, key: &[u8])
fn invalidate(&self, key: &[u8])
Invalidate a cached entry. Read more
Auto Trait Implementations§
impl !Freeze for FoyerMemoryCache
impl !RefUnwindSafe for FoyerMemoryCache
impl Send for FoyerMemoryCache
impl Sync for FoyerMemoryCache
impl Unpin for FoyerMemoryCache
impl UnsafeUnpin for FoyerMemoryCache
impl !UnwindSafe for FoyerMemoryCache
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.