Arguments
str
required
The key
Response
The number of milliseconds until this expires, negative if the key does not exist or does not have an expiration set.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
redis.set("key1", "Hello")
assert redis.pttl("key1") == -1
redis.expire("key1", 1000)
assert redis.pttl("key1") > 0
redis.persist("key1")
assert redis.pttl("key1") == -1
Return the expiration in milliseconds of a key.
redis.set("key1", "Hello")
assert redis.pttl("key1") == -1
redis.expire("key1", 1000)
assert redis.pttl("key1") > 0
redis.persist("key1")
assert redis.pttl("key1") == -1
Was this page helpful?