pub fn purge(&mut self) -> Vec<String> {
        let mut cache = HashMap::with_capacity(self.cache.len());
        mem::swap(&mut self.cache, &mut cache);

        let (expired, keep): (HashMap<_, _>, HashMap<_, _>) = cache
            .into_iter()
            .partition(|(_, timestamp)| timestamp.elapsed() > self.keep_time);

        for (head, timestamp) in keep {
            self.cache.insert(head, timestamp);
        }

        expired.into_iter().map(|(key, _)| key).collect()
    }
/// Remove and return all forks that have been in the cache longer than `keep_time`.
Remove and return all forks that have been in the cache longer than `keep_time`.
Remove and return all forks that have been in the cache longer than ` keep_time ` .
pub fn purge(&mut self) -> Vec<String> {
        let mut cache = HashMap::with_capacity(self.cache.len());
        mem::swap(&mut self.cache, &mut cache);
        let (expired, keep): (HashMap<_, _>, HashMap<_, _>) = cache
            .into_iter()
            .partition(|(_, timestamp)| timestamp.elapsed() > self.keep_time);
        for (head, timestamp) in keep {
            self.cache.insert(head, timestamp);
        }
        expired.into_iter().map(|(key, _)| key).collect()
    }
pub fn purge ( & mut self ) -> Vec < String > { let mut cache = HashMap :: with_capacity ( self . cache . len ( ) ) ; mem :: swap ( & mut self . cache , & mut cache ) ; let ( expired , keep ) : ( HashMap < _ , _ > , HashMap < _ , _ > ) = cache . into_iter ( ) . partition ( | ( _ , timestamp ) | timestamp . elapsed ( ) > self . keep_time ) ; for ( head , timestamp ) in keep { self . cache . insert ( head , timestamp ) ; } expired . into_iter ( ) . map ( | ( key , _ ) | key ) . collect ( ) }
Remove and return all forks that have been in the cache longer than `keep_time`.
Remove and return all forks that have been in the cache longer than ` keep_time ` .
&mut self