From 02d2b60d053b0b9039f18cda7438ecf180094ff5 Mon Sep 17 00:00:00 2001 From: "jiangyujie.jyj" Date: Fri, 16 Aug 2024 17:38:06 +0800 Subject: [PATCH] Add lfu support for debug object command. Signed-off-by: jiangyujie.jyj --- src/debug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/debug.c b/src/debug.c index 6a568315b5..ce322ded8f 100644 --- a/src/debug.c +++ b/src/debug.c @@ -658,7 +658,9 @@ void debugCommand(client *c) { sds s = sdsempty(); s = sdscatprintf(s, "Value at:%p refcount:%d encoding:%s", (void *)val, val->refcount, strenc); if (!fast) s = sdscatprintf(s, " serializedlength:%zu", rdbSavedObjectLen(val, c->argv[2], c->db->id)); + /* Either lru or lfu field could work correctly which depends on server.maxmemory_policy. */ s = sdscatprintf(s, " lru:%d lru_seconds_idle:%llu", val->lru, estimateObjectIdleTime(val) / 1000); + s = sdscatprintf(s, " lfu_freq:%lu lfu_access_time_minutes:%u", LFUDecrAndReturn(val), val->lru >> 8); s = sdscatprintf(s, "%s", extra); addReplyStatusLength(c, s, sdslen(s)); sdsfree(s);