Skip to content

Commit

Permalink
Add lfu support for debug object command.
Browse files Browse the repository at this point in the history
Signed-off-by: jiangyujie.jyj <yjjiang1996@163.com>
  • Loading branch information
DarrenJiang13 committed May 10, 2024
1 parent fdd023f commit 311fac2
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,13 +648,23 @@ NULL
remaining -= used;
}

addReplyStatusFormat(c,
"Value at:%p refcount:%d "
"encoding:%s serializedlength:%zu "
"lru:%d lru_seconds_idle:%llu%s",
(void*)val, val->refcount,
strenc, rdbSavedObjectLen(val, c->argv[2], c->db->id),
val->lru, estimateObjectIdleTime(val)/1000, extra);
if (server.maxmemory_policy & MAXMEMORY_FLAG_LFU) {
addReplyStatusFormat(c,
"Value at:%p refcount:%d "
"encoding:%s serializedlength:%zu "
"lfu_freq:%d lfu_access_time_minutes:%u%s",
(void*)val, val->refcount,
strenc, rdbSavedObjectLen(val, c->argv[2], c->db->id),
val->lru & 255, val->lru >> 8, extra);
} else {
addReplyStatusFormat(c,
"Value at:%p refcount:%d "
"encoding:%s serializedlength:%zu "
"lru:%d lru_seconds_idle:%llu%s",
(void*)val, val->refcount,
strenc, rdbSavedObjectLen(val, c->argv[2], c->db->id),
val->lru, estimateObjectIdleTime(val)/1000, extra);
}
} else if (!strcasecmp(c->argv[1]->ptr,"sdslen") && c->argc == 3) {
dictEntry *de;
robj *val;
Expand Down

0 comments on commit 311fac2

Please sign in to comment.