MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / lru_eviction

Function lru_eviction

nodedb/src/engine/timeseries/query_cache.rs:186–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

184
185 #[test]
186 fn lru_eviction() {
187 let mut cache = QueryCache::new(100);
188 cache.insert(T1, 1, 0, vec![0u8; 40]);
189 cache.insert(T1, 2, 0, vec![0u8; 40]);
190 assert_eq!(cache.len(), 2);
191
192 // This should evict partition 1's entry.
193 cache.insert(T1, 3, 0, vec![0u8; 40]);
194 assert_eq!(cache.len(), 2);
195 assert!(cache.get(T1, 1, 0).is_none()); // Evicted.
196 assert!(cache.get(T1, 3, 0).is_some());
197 }
198
199 #[test]
200 fn invalidate_partition() {

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected