MCPcopy Create free account
hub / github.com/cosdata/cosdata / insert

Method insert

src/models/lru_cache.rs:226–231  ·  view source on GitHub ↗

Inserts an entry into the cache Note that if the entry is already present in cache, it will be overwritten

(&self, key: K, value: V)

Source from the content-addressed store, hash-verified

224 /// Note that if the entry is already present in cache, it will be
225 /// overwritten
226 pub fn insert(&self, key: K, value: V) {
227 let counter = self.increment_counter();
228 self.map.insert(key.clone(), (value, counter));
229 self.index.on_cache_miss(counter, key.into());
230 self.evict();
231 }
232
233 /// Gets the value from the cache if it exists, else tries to
234 /// insert the result of the fn `f` into the cache and returns the

Callers 2

test_values_iteratorFunction · 0.45
test_eviction_indexFunction · 0.45

Calls 4

increment_counterMethod · 0.80
cloneMethod · 0.80
on_cache_missMethod · 0.80
evictMethod · 0.80

Tested by 2

test_values_iteratorFunction · 0.36
test_eviction_indexFunction · 0.36