crate::ix!();
pub trait CacheInterface:
CacheInsert
+ CacheLookup
+ CacheRelease
+ CacheValue
+ CacheErase
+ CacheNewId
+ CachePrune
+ CacheTotalCharge {}
impl<T> CacheInterface for T where
T: CacheInsert
+ CacheLookup
+ CacheRelease
+ CacheValue
+ CacheErase
+ CacheNewId
+ CachePrune
+ CacheTotalCharge
{
}
pub type CacheDeleterFn = fn(key_: &Slice, value: *mut c_void);
pub trait CacheInsert {
fn insert(
&mut self,
key_: &Slice,
value: *mut c_void,
charge: usize,
deleter: CacheDeleterFn,
) -> *mut CacheHandle;
}
pub trait CacheLookup {
fn lookup(&mut self, key_: &Slice) -> *mut CacheHandle;
}
pub trait CacheRelease {
fn release(&mut self, handle: *mut CacheHandle);
}
pub trait CacheValue {
fn value(&mut self, handle: *mut CacheHandle) -> *mut c_void;
}
pub trait CacheErase {
fn erase(&mut self, key_: &Slice);
}
pub trait CacheNewId {
fn new_id(&mut self) -> u64;
}
pub trait CachePrune {
fn prune(&mut self);
}
pub trait CacheTotalCharge {
fn total_charge(&self) -> usize;
}