# With millisecondsredis.set("mykey", "Hello")redis.expire("mykey", 500)# With a timedeltaredis.set("mykey", "Hello")redis.expire("mykey", datetime.timedelta(milliseconds=500))
Generic
PEXPIRE
Sets a timeout on key. After the timeout has expired, the key will automatically be deleted.
Copy
Ask AI
# With millisecondsredis.set("mykey", "Hello")redis.expire("mykey", 500)# With a timedeltaredis.set("mykey", "Hello")redis.expire("mykey", datetime.timedelta(milliseconds=500))
# With millisecondsredis.set("mykey", "Hello")redis.expire("mykey", 500)# With a timedeltaredis.set("mykey", "Hello")redis.expire("mykey", datetime.timedelta(milliseconds=500))