Node-redis: TTL command returns true instead of time

Created on 19 Apr 2015  ·  2Comments  ·  Source: NodeRedis/node-redis

Hi,

redis.ttl(key)

returns true, while it should return the time to expiration according to the redis documentation.

Is there a way to get the remaining time ?

Thanks.

question

Most helpful comment

All Redis commands in Node.js are asynchronous which means you'll have to catch the result in a callback:

redis.ttl(key, function(error, ttl){
   console.log('TTL is', ttl)
});

All 2 comments

All Redis commands in Node.js are asynchronous which means you'll have to catch the result in a callback:

redis.ttl(key, function(error, ttl){
   console.log('TTL is', ttl)
});

Hi,

Yes, sorry, I just figured it out a few minutes after posting this issue. That is why I closed it immediately.

Thanks for your answer anyway.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

twappworld picture twappworld  ·  7Comments

gpascale picture gpascale  ·  4Comments

yuany picture yuany  ·  4Comments

Stono picture Stono  ·  6Comments

ghost picture ghost  ·  3Comments