| 610 | } |
| 611 | |
| 612 | void 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 | |
| 637 | static void updateSysAvailableMemory() { |
| 638 | if (g_pserver->force_eviction_percent) { |
no test coverage detected