NTTL
NTTL key
- Group
- Keys
- Complexity
- O(1)
- Arity
- 2 (exactly, counting the command name)
- Flags
- read-only, fast
- Keys
- first 1, last 1, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
NTTL returns how many nanoseconds are left before key expires. It works
for any time to live, however it was set (EXPIRE,
SET with PX, NEXPIRE, and so on).
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| The key has a time to live | Integer: nanoseconds left | Integer |
| The key exists without a time to live | Integer -1 |
Integer -1 |
| The key does not exist | Integer -2 |
Integer -2 |
Examples
Section titled “Examples”127.0.0.1:6379> SET lease "worker-3"OK127.0.0.1:6379> NEXPIRE lease 5000000(integer) 1127.0.0.1:6379> NTTL lease(integer) 4981233127.0.0.1:6379> NTTL missing(integer) -2Compatibility
Section titled “Compatibility”HotKV-only command.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.