MCPcopy Create free account
hub / github.com/ElementsProject/elements / Insert

Method Insert

src/leveldb/util/cache.cc:78–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76 }
77
78 LRUHandle* Insert(LRUHandle* h) {
79 LRUHandle** ptr = FindPointer(h->key(), h->hash);
80 LRUHandle* old = *ptr;
81 h->next_hash = (old == nullptr ? nullptr : old->next_hash);
82 *ptr = h;
83 if (old == nullptr) {
84 ++elems_;
85 if (elems_ > length_) {
86 // Since each cache entry is fairly large, we aim for a small
87 // average linked list length (<= 1).
88 Resize();
89 }
90 }
91 return old;
92 }
93
94 LRUHandle* Remove(const Slice& key, uint32_t hash) {
95 LRUHandle** ptr = FindPointer(key, hash);

Callers

nothing calls this directly

Calls 1

keyMethod · 0.45

Tested by

no test coverage detected