Struct ccache::slru::SLRUShared [−][src]
pub struct SLRUShared<'a, Hmap, E, K, V, CidT, Umeta, HB> where
Hmap: HashMap<E, K, V, CidT, Umeta, HB>,
E: EntryT<K, V, CidT, Umeta>,
K: Hash,
V: Val,
CidT: Cid,
Umeta: Meta<V>,
HB: BuildHasher + Default, { /* fields omitted */ }
Actual implementation of the SLRU on a shared hashmap
Note that Insert/Remove do not actually insert anything in the hashmap. That must be done by the caller. We only fix all the pointers and SLRU status
Implementations
impl<'a, Hmap: HashMap<E, K, V, CidT, Umeta, HB>, E: EntryT<K, V, CidT, Umeta>, K: Hash, V: Val, CidT: Cid, Umeta: Meta<V>, HB: BuildHasher + Default> SLRUShared<'a, Hmap, E, K, V, CidT, Umeta, HB>
[src]
impl<'a, Hmap: HashMap<E, K, V, CidT, Umeta, HB>, E: EntryT<K, V, CidT, Umeta>, K: Hash, V: Val, CidT: Cid, Umeta: Meta<V>, HB: BuildHasher + Default> SLRUShared<'a, Hmap, E, K, V, CidT, Umeta, HB>
[src]pub fn new(
probation: (usize, CidT),
protected: (usize, CidT),
access_scan: Option<&'a dyn Fn(NonNull<E>)>
) -> Self
[src]
probation: (usize, CidT),
protected: (usize, CidT),
access_scan: Option<&'a dyn Fn(NonNull<E>)>
) -> Self
new SLRU with custom number of probatory/protected entries plus an optional callback for the lazy scan
pub fn set_scanf(&mut self, access_scan: Option<&'a dyn Fn(NonNull<E>)>)
[src]
change the scan callback
pub fn insert_shared(
&mut self,
hmap: &mut Hmap,
maybe_old_entry: Option<&mut E>,
new_entry_idx: usize
) -> InsertResultShared<E>
[src]
&mut self,
hmap: &mut Hmap,
maybe_old_entry: Option<&mut E>,
new_entry_idx: usize
) -> InsertResultShared<E>
an itam has been inserted by the caller, fix the SLRU
maybe_old_entry
must be != None
only if the element is in the SLRU
pub fn clear_shared(&mut self)
[src]
Reset the SLRU state
pub fn remove_shared(&mut self, entry: &E)
[src]
do not actually remove the element, just fix the SLRU so that it is not considered anymore and actual removal is safe
pub fn get_cache_ids(&self) -> (CidT, CidT)
[src]
return the cache ids for (probatory, protected)
pub fn on_get(&mut self, entry: &mut E)
[src]
Should be called only by the parent, run the on-get callback on the correct LRU
pub fn start_scan(&mut self)
[src]
start the scan callbacks on the SLRU scan will execute only once on the whole SLRU
pub fn is_scan_running(&self) -> bool
[src]
return scan status
pub fn capacity(&self) -> usize
[src]
return max SLRU size
pub fn len(&self) -> usize
[src]
return used SLRU size
Auto Trait Implementations
impl<'a, Hmap, E, K, V, CidT, Umeta, HB> !RefUnwindSafe for SLRUShared<'a, Hmap, E, K, V, CidT, Umeta, HB>
impl<'a, Hmap, E, K, V, CidT, Umeta, HB> !RefUnwindSafe for SLRUShared<'a, Hmap, E, K, V, CidT, Umeta, HB>
impl<'a, Hmap, E, K, V, CidT, Umeta, HB> !Send for SLRUShared<'a, Hmap, E, K, V, CidT, Umeta, HB>
impl<'a, Hmap, E, K, V, CidT, Umeta, HB> !Send for SLRUShared<'a, Hmap, E, K, V, CidT, Umeta, HB>
impl<'a, Hmap, E, K, V, CidT, Umeta, HB> !Sync for SLRUShared<'a, Hmap, E, K, V, CidT, Umeta, HB>
impl<'a, Hmap, E, K, V, CidT, Umeta, HB> !Sync for SLRUShared<'a, Hmap, E, K, V, CidT, Umeta, HB>
impl<'a, Hmap, E, K, V, CidT, Umeta, HB> Unpin for SLRUShared<'a, Hmap, E, K, V, CidT, Umeta, HB> where
CidT: Unpin,
HB: Unpin,
Hmap: Unpin,
K: Unpin,
Umeta: Unpin,
V: Unpin,
impl<'a, Hmap, E, K, V, CidT, Umeta, HB> Unpin for SLRUShared<'a, Hmap, E, K, V, CidT, Umeta, HB> where
CidT: Unpin,
HB: Unpin,
Hmap: Unpin,
K: Unpin,
Umeta: Unpin,
V: Unpin,
impl<'a, Hmap, E, K, V, CidT, Umeta, HB> !UnwindSafe for SLRUShared<'a, Hmap, E, K, V, CidT, Umeta, HB>
impl<'a, Hmap, E, K, V, CidT, Umeta, HB> !UnwindSafe for SLRUShared<'a, Hmap, E, K, V, CidT, Umeta, HB>