MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / put

Method put

include/engine/framework/runtime/cache_slots.h:49–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 }
48
49 void put(Key key, Value value) {
50 if (capacity_ == 0) {
51 entries_.clear();
52 return;
53 }
54 for (auto & entry : entries_) {
55 if (equal_(entry.key, key)) {
56 entry.key = std::move(key);
57 entry.value = std::move(value);
58 entry.last_used = next_tick();
59 return;
60 }
61 }
62 if (entries_.size() >= capacity_) {
63 erase_lru();
64 }
65 entries_.push_back(Entry{
66 std::move(key),
67 std::move(value),
68 next_tick(),
69 });
70 }
71
72 template <typename Fn>
73 void for_each_value(Fn && fn) {

Callers

nothing calls this directly

Calls 2

clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected