Skip to main content

RangeCacheBackend

Trait RangeCacheBackend 

Source
pub trait RangeCacheBackend: Send + Sync {
    // Required methods
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        expected_len: u64,
    ) -> Pin<Box<dyn Future<Output = Option<Bytes>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn put<'life0, 'async_trait>(
        &'life0 self,
        key: String,
        value: Bytes,
        hint: FillHint,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;

    // Provided methods
    fn disk_stats(&self) -> Option<BackendDiskStats> { ... }
    fn ram_usage_bytes(&self) -> Option<usize> { ... }
    fn ram_entries(&self) -> Option<usize> { ... }
}

Required Methods§

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, expected_len: u64, ) -> Pin<Box<dyn Future<Output = Option<Bytes>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

expected_len is the exact length the caller will accept for key. A backend MUST NOT copy a value whose length differs into any faster tier it maintains (the promotion gate) and MUST treat such a value as a miss. Single-tier backends accept and ignore the parameter.

Source

fn put<'life0, 'async_trait>( &'life0 self, key: String, value: Bytes, hint: FillHint, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Provided Methods§

Source

fn disk_stats(&self) -> Option<BackendDiskStats>

Disk write-path counters, for the saturation monitor’s per-second gauges. Defaulted to None so backends without a disk tier (e.g. MemoryBackend) need no override.

Source

fn ram_usage_bytes(&self) -> Option<usize>

Accounted RAM-tier byte usage, for the saturation monitor’s residency gauge. None for backends with no RAM tier accounting (e.g. MemoryBackend). Divergence between this and process RSS is the signature of a cached value pinning more than its accounted weight.

Source

fn ram_entries(&self) -> Option<usize>

Accounted RAM-tier entry count, the entry-count sibling to ram_usage_bytes. None for backends with no RAM tier accounting (e.g. MemoryBackend).

Implementors§