MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / evict_lru

Method evict_lru

atomic-repository/src/changestore/cache.rs:106–115  ·  view source on GitHub ↗

Evict the least recently used entry.

(&mut self)

Source from the content-addressed store, hash-verified

104
105 /// Evict the least recently used entry.
106 fn evict_lru(&mut self) {
107 if let Some(lru_key) = self
108 .entries
109 .iter()
110 .min_by_key(|(_, entry)| entry.last_access)
111 .map(|(k, _)| k.clone())
112 {
113 self.entries.remove(&lru_key);
114 }
115 }
116
117 /// Get the current number of entries in the cache.
118 #[cfg(test)]

Callers 1

insertMethod · 0.80

Calls 3

removeMethod · 0.65
iterMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected