/// evicts up to 'n' entries from the LRU list. Returns the number of evicted entries which
/// may be less than 'n' in case the list got depleted.
evicts up to 'n' entries from the LRU list. Returns the number of evicted entries which
may be less than 'n' in case the list got depleted.
evicts up to ' n ' entries from the LRU list . Returns the number of evicted entries which may be less than ' n ' in case the list got depleted .
pub(crate) fn evict(
        &self,
        n: usize,
        map_lock: &mut MutexGuard<HashSet<Pin<Box<Entry<K, V>>>>>,
    ) -> usize {
        #[cfg(feature = "logging")]
        debug!("evicting {} elements", n);
        for i in 0..n {
            if let Some(entry) = self.lru_list.lock().pop_front() {
                map_lock.remove(&entry.key);
                self.cached.fetch_sub(1, Ordering::Relaxed);
            } else {
                return i;
            }
        }
        n
    }
pub ( crate ) fn evict ( & self , n : usize , map_lock : & mut MutexGuard < HashSet < Pin < Box < Entry < K , V > > > > > , ) -> usize { # [ cfg ( feature " " ) ] debug ! ( " " n ) ; for i in 0 .. n { if let Some ( entry ) = self . lru_list . lock ( ) . pop_front ( ) { map_lock . remove ( & entry . key ) ; self . cached . fetch_sub ( 1 , Ordering :: Relaxed ) ; } else { return i ; } } n }
evicts up to 'n' entries from the LRU list.
evicts up to ' n ' entries from the LRU list .
&self
n
usize
map_lock
&mut MutexGuard<HashSet<Pin<Box<Entry<K, V>>>>>