NEXPIREAT
NEXPIREAT key unix-time-nanoseconds
- Group
- Keys
- Complexity
- O(1)
- Arity
- 3 (exactly, counting the command name)
- Flags
- write, fast
- Keys
- first 1, last 1, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
NEXPIREAT sets the moment key expires as an absolute Unix timestamp in
nanoseconds. It always replaces the current time to live. A timestamp that is
already in the past makes the key expire at once.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| The time was set | Integer 1 |
Integer 1 |
| The key does not exist | Integer 0 |
Integer 0 |
ERR value is not an integer or out of range when the timestamp is not a
64-bit integer.
Examples
Section titled “Examples”127.0.0.1:6379> SET report "q3"OK127.0.0.1:6379> NEXPIREAT report 1893456000000000000(integer) 1127.0.0.1:6379> PEXPIRETIME report(integer) 1893456000000Compatibility
Section titled “Compatibility”HotKV-only command. Unlike EXPIREAT, it takes no
NX, XX, GT or LT options and does not publish an expire keyspace
event.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.