GETEX
GETEX key [EX seconds | PX milliseconds | EXAT unix-time-seconds | PXAT unix-time-milliseconds | PERSIST]
@write, @string, @fast, Get the value of key and optionally set its expiration. GETEX is similar to GET, but is a write command with additional options.
The GETEX command supports a set of options that modify its behavior:
EX seconds -- Set the specified expire time, in seconds.PX milliseconds -- Set the specified expire time, in milliseconds.EXAT timestamp-seconds -- Set the specified Unix time at which the key will expire, in seconds.PXAT timestamp-milliseconds -- Set the specified Unix time at which the key will expire, in milliseconds.PERSIST -- Remove the time to live associated with the key.Bulk string reply: the value of key, or nil when key does not exist.
SET mykey "Hello" GETEX mykey TTL mykey GETEX mykey EX 60 TTL mykey
© 2006–2022 Salvatore Sanfilippo
Licensed under the Creative Commons Attribution-ShareAlike License 4.0.
https://redis.io/commands/getex/