Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API documentation of EXPIRETIME and PEXPIRETIME commands #1582

Merged
merged 9 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,18 @@
"since": "1.2.0",
"group": "generic"
},
"EXPIRETIME": {
"summary": "Get the expiration Unix timestamp for a key",
"complexity": "O(1)",
"arguments": [
{
"name": "key",
"type": "key"
}
],
"since": "7.0.0",
"group": "generic"
},
"FAILOVER": {
"summary": "Start a coordinated failover between this server and one of its replicas.",
"arguments": [
Expand Down Expand Up @@ -2864,6 +2876,18 @@
"since": "2.6.0",
"group": "generic"
},
"PEXPIRETIME": {
"summary": "Get the expiration Unix timestamp for a key in milliseconds",
"complexity": "O(1)",
"arguments": [
{
"name": "key",
"type": "key"
}
],
"since": "7.0.0",
"group": "generic"
},
"PFADD": {
"summary": "Adds the specified elements to the specified HyperLogLog.",
"complexity": "O(1) to add every element.",
Expand Down
17 changes: 17 additions & 0 deletions commands/expiretime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Returns the absolute Unix timestamp (since January 1, 1970) in seconds at which the given key will expire.

See also the `PEXPIRETIME` command which returns the same information with milliseconds resolution.

@return

@integer-reply: Expiration Unix timestamp in seconds, or a negative value in order to signal an error (see the description below).
* The command returns `-1` if the key exists but has no associated expiration time.
* The command returns `-2` if the key does not exist.

@examples

```cli
SET mykey "Hello"
EXPIREAT mykey 33177117420
EXPIRETIME mykey
```
15 changes: 15 additions & 0 deletions commands/pexpiretime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
`PEXPIRETIME` has the same semantic as `EXPIRETIME`, but returns the absolute Unix expiration timestamp in milliseconds instead of seconds.

@return

@integer-reply: Expiration Unix timestamp in milliseconds, or a negative value in order to signal an error (see the description below).
* The command returns `-1` if the key exists but has no associated expiration time.
* The command returns `-2` if the key does not exist.

@examples

```cli
SET mykey "Hello"
PEXPIREAT mykey 33177117420000
PEXPIRETIME mykey
```