MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / evict

Function evict

src/evict.cpp:612–635  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

610}
611
612void evict(redisDb *db, robj *keyobj) {
613 mstime_t eviction_latency;
614 propagateExpire(db,keyobj,g_pserver->lazyfree_lazy_eviction);
615 /* We compute the amount of memory freed by db*Delete() alone.
616 * It is possible that actually the memory needed to propagate
617 * the DEL in AOF and replication link is greater than the one
618 * we are freeing removing the key, but we can't account for
619 * that otherwise we would never exit the loop.
620 *
621 * AOF and Output buffer memory will be freed eventually so
622 * we only care about memory used by the key space. */
623 latencyStartMonitor(eviction_latency);
624 if (g_pserver->lazyfree_lazy_eviction)
625 dbAsyncDelete(db,keyobj);
626 else
627 dbSyncDelete(db,keyobj);
628 latencyEndMonitor(eviction_latency);
629 latencyAddSampleIfNeeded("eviction-del",eviction_latency);
630
631 signalModifiedKey(NULL,db,keyobj);
632 notifyKeyspaceEvent(NOTIFY_EVICTED, "evicted",
633 keyobj, db->id);
634 decrRefCount(keyobj);
635}
636
637static void updateSysAvailableMemory() {
638 if (g_pserver->force_eviction_percent) {

Callers 1

performEvictionsFunction · 0.85

Calls 6

propagateExpireFunction · 0.85
dbAsyncDeleteFunction · 0.85
dbSyncDeleteFunction · 0.85
signalModifiedKeyFunction · 0.85
notifyKeyspaceEventFunction · 0.85
decrRefCountFunction · 0.85

Tested by

no test coverage detected