TTL
127.0.0.1:6379> TTL <key>
(integer) 24Expire
127.0.0.1:6379> EXPIRE <key> <seconds>
(integer) 1Options:
| Option | Beschreibung |
|---|---|
NX | Set expiry only when the key has no expiry |
XX | Set expiry only when the key has an existing expiry |
GT | Set expiry only when the new expiry is greater than current one |
LT | Set expiry only when the new expiry is less than current one ne |
EXPIREAT
127.0.0.1:6379> EXPIREAT <key> <unixTimestamp>
(integer) 1
127.0.0.1:6379> EXPIRETIME <key>
(integer) 33177117420