Evicts entries from the LRU cache until `memory_used` is lower than `memory_limit`.
(&mut self)
| 268 | |
| 269 | /// Evicts entries from the LRU cache until `memory_used` is lower than `memory_limit`. |
| 270 | fn evict_entries(&mut self) { |
| 271 | while self.memory_used > self.memory_limit { |
| 272 | if let Some(removed) = self.lru_queue.pop() { |
| 273 | self.memory_used -= removed.1.size_bytes; |
| 274 | } else { |
| 275 | // cache is empty while memory_used > memory_limit, cannot happen |
| 276 | debug_assert!( |
| 277 | false, |
| 278 | "cache is empty while memory_used > memory_limit, cannot happen" |
| 279 | ); |
| 280 | return; |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | /// Removes an entry from the cache and returns it, if it exists. |
| 286 | fn remove(&mut self, k: &TableScopedPath) -> Option<CachedFileList> { |
no test coverage detected