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

Method Unref

src/leveldb/util/cache.cc:225–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225void LRUCache::Unref(LRUHandle* e) {
226 assert(e->refs > 0);
227 e->refs--;
228 if (e->refs == 0) { // Deallocate.
229 assert(!e->in_cache);
230 (*e->deleter)(e->key(), e->value);
231 free(e);
232 } else if (e->in_cache && e->refs == 1) {
233 // No longer in use; move to lru_ list.
234 LRU_Remove(e);
235 LRU_Append(&lru_, e);
236 }
237}
238
239void LRUCache::LRU_Remove(LRUHandle* e) {
240 e->next->prev = e->prev;

Callers 3

~MemTableConstructorMethod · 0.45
FinishImplMethod · 0.45
TESTFunction · 0.45

Calls 1

keyMethod · 0.45

Tested by 3

~MemTableConstructorMethod · 0.36
FinishImplMethod · 0.36
TESTFunction · 0.36