Generic

PTTL

Return the expiration in milliseconds of a key.

Arguments

keybodystrrequired

The key

Response

intrequired

The number of milliseconds until this expires, negative if the key does not exist or does not have an expiration set.

Example
redis.set("key1", "Hello")assert redis.pttl("key1") == -1redis.expire("key1", 1000)assert redis.pttl("key1") > 0redis.persist("key1")assert redis.pttl("key1") == -1
Loading search…