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

shmendo picture shmendo  路  6Comments

dotSlashLu picture dotSlashLu  路  5Comments

adamgajzlerowicz picture adamgajzlerowicz  路  4Comments

Atala picture Atala  路  3Comments

abhaygarg picture abhaygarg  路  5Comments