MCPcopy Create free account
hub / github.com/apache/datafusion / evict_entries

Method evict_entries

datafusion/execution/src/cache/file_metadata_cache.rs:89–102  ·  view source on GitHub ↗

Evicts entries from the LRU cache until `memory_used` is lower than `memory_limit`.

(&mut self)

Source from the content-addressed store, hash-verified

87
88 /// Evicts entries from the LRU cache until `memory_used` is lower than `memory_limit`.
89 fn evict_entries(&mut self) {
90 while self.memory_used > self.memory_limit {
91 if let Some(removed) = self.lru_queue.pop() {
92 self.memory_used -= removed.1.file_metadata.memory_size();
93 } else {
94 // cache is empty while memory_used > memory_limit, cannot happen
95 debug_assert!(
96 false,
97 "cache is empty while memory_used > memory_limit, cannot happen"
98 );
99 return;
100 }
101 }
102 }
103
104 /// Removes an entry from the cache and returns it, if it exists.
105 fn remove(&mut self, k: &Path) -> Option<CachedFileMetadataEntry> {

Callers 2

putMethod · 0.45
update_cache_limitMethod · 0.45

Calls 2

popMethod · 0.45
memory_sizeMethod · 0.45

Tested by

no test coverage detected