mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Fix OBJECT IDLETIME return value converting to seconds.
estimateObjectIdleTime() returns a value in milliseconds now, so we need to scale the output of OBJECT IDLETIME to seconds.
This commit is contained in:
parent
ad6b0f70b2
commit
6d5790d682
@ -648,7 +648,7 @@ char *strEncoding(int encoding) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Given an object returns the min number of seconds the object was never
|
/* Given an object returns the min number of milliseconds the object was never
|
||||||
* requested, using an approximated LRU algorithm. */
|
* requested, using an approximated LRU algorithm. */
|
||||||
unsigned long long estimateObjectIdleTime(robj *o) {
|
unsigned long long estimateObjectIdleTime(robj *o) {
|
||||||
unsigned long long lruclock = LRU_CLOCK();
|
unsigned long long lruclock = LRU_CLOCK();
|
||||||
@ -692,7 +692,7 @@ void objectCommand(redisClient *c) {
|
|||||||
} else if (!strcasecmp(c->argv[1]->ptr,"idletime") && c->argc == 3) {
|
} else if (!strcasecmp(c->argv[1]->ptr,"idletime") && c->argc == 3) {
|
||||||
if ((o = objectCommandLookupOrReply(c,c->argv[2],shared.nullbulk))
|
if ((o = objectCommandLookupOrReply(c,c->argv[2],shared.nullbulk))
|
||||||
== NULL) return;
|
== NULL) return;
|
||||||
addReplyLongLong(c,estimateObjectIdleTime(o));
|
addReplyLongLong(c,estimateObjectIdleTime(o)/1000);
|
||||||
} else {
|
} else {
|
||||||
addReplyError(c,"Syntax error. Try OBJECT (refcount|encoding|idletime)");
|
addReplyError(c,"Syntax error. Try OBJECT (refcount|encoding|idletime)");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user