micro-moka 0.1.18

A lightweight, single-threaded cache library with W-TinyLFU eviction
Documentation
1
2
3
4
5
6
7
8
use std::convert::TryInto;

pub(crate) mod frequency_sketch;

// Ensures the value fits in a range of `128u32..=u32::MAX`.
pub(crate) fn sketch_capacity(max_capacity: u64) -> u32 {
    max_capacity.try_into().unwrap_or(u32::MAX).max(128)
}