pub struct CacheManager { /* private fields */ }Expand description
Multi-tier cache manager
Implementations§
Source§impl CacheManager
impl CacheManager
Sourcepub fn new(l1_size: usize, l2_dir: impl AsRef<Path>) -> Result<Self>
pub fn new(l1_size: usize, l2_dir: impl AsRef<Path>) -> Result<Self>
Create a new cache manager
Sourcepub fn get(&self, namespace: &str, key: &str, env: &str) -> Result<ConfigEntry>
pub fn get(&self, namespace: &str, key: &str, env: &str) -> Result<ConfigEntry>
Get an entry from the cache
Search order:
- L1 cache (fastest)
- L2 cache (fast)
- Return cache miss
Sourcepub fn put(&self, entry: ConfigEntry) -> Result<()>
pub fn put(&self, entry: ConfigEntry) -> Result<()>
Put an entry into the cache (both L1 and L2)
Sourcepub fn invalidate(&self, namespace: &str, key: &str, env: &str) -> Result<()>
pub fn invalidate(&self, namespace: &str, key: &str, env: &str) -> Result<()>
Invalidate an entry from both caches
Sourcepub fn l1_stats(&self) -> CacheStats
pub fn l1_stats(&self) -> CacheStats
Get L1 cache statistics
Auto Trait Implementations§
impl Freeze for CacheManager
impl RefUnwindSafe for CacheManager
impl Send for CacheManager
impl Sync for CacheManager
impl Unpin for CacheManager
impl UnwindSafe for CacheManager
Blanket Implementations§
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