-
Notifications
You must be signed in to change notification settings - Fork 232
DEV: add new HFE commands #1204
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
acl_categories: | ||
- '@write' | ||
- '@hash' | ||
- '@fast' | ||
arguments: | ||
- display_text: key | ||
key_spec_index: 0 | ||
name: key | ||
type: key | ||
- arguments: | ||
- display_text: numfields | ||
name: numfields | ||
type: integer | ||
- display_text: field | ||
multiple: true | ||
name: field | ||
type: string | ||
name: fields | ||
token: FIELDS | ||
type: block | ||
arity: -5 | ||
categories: | ||
- docs | ||
- develop | ||
- stack | ||
- oss | ||
- rs | ||
- rc | ||
- oss | ||
- kubernetes | ||
- clients | ||
command_flags: | ||
- write | ||
- fast | ||
complexity: O(N) where N is the number of specified fields | ||
description: Returns the value of a field and deletes it from the hash. | ||
group: hash | ||
hidden: false | ||
key_specs: | ||
- RW: true | ||
access: true | ||
begin_search: | ||
spec: | ||
index: 1 | ||
type: index | ||
delete: true | ||
find_keys: | ||
spec: | ||
keystep: 1 | ||
lastkey: 0 | ||
limit: 0 | ||
type: range | ||
linkTitle: HGETDEL | ||
since: 8.0.0 | ||
summary: Returns the value of a field and deletes it from the hash. | ||
syntax_fmt: "HGETDEL key FIELDS\_numfields field [field ...]" | ||
syntax_str: "FIELDS\_numfields field [field ...]" | ||
title: HGETDEL | ||
--- | ||
Get and delete the value of one or more fields of a given hash key. When the last field is deleted, the key will also be deleted. | ||
|
||
## Example | ||
|
||
``` | ||
redis> HSET mykey field1 "Hello" field2 "World" field3 "!" | ||
(integer) 3 | ||
redis> HGETALL mykey | ||
1) "field1" | ||
2) "Hello" | ||
3) "field2" | ||
4) "World" | ||
5) "field3" | ||
6) "!" | ||
redis> HGETDEL mykey FIELDS 2 field3 field4 | ||
1) "!" | ||
2) (nil) | ||
redis> HGETALL mykey | ||
1) "field1" | ||
2) "Hello" | ||
3) "field2" | ||
4) "World" | ||
redis> HGETDEL mykey FIELDS 2 field1 field2 | ||
1) "Hello" | ||
2) "World" | ||
redis> KEYS * | ||
(empty array) | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
--- | ||
acl_categories: | ||
- '@write' | ||
- '@hash' | ||
- '@fast' | ||
arguments: | ||
- display_text: key | ||
key_spec_index: 0 | ||
name: key | ||
type: key | ||
- arguments: | ||
- display_text: seconds | ||
name: seconds | ||
token: EX | ||
type: integer | ||
- display_text: milliseconds | ||
name: milliseconds | ||
token: PX | ||
type: integer | ||
- display_text: unix-time-seconds | ||
name: unix-time-seconds | ||
token: EXAT | ||
type: unix-time | ||
- display_text: unix-time-milliseconds | ||
name: unix-time-milliseconds | ||
token: PXAT | ||
type: unix-time | ||
- display_text: persist | ||
name: persist | ||
token: PERSIST | ||
type: pure-token | ||
name: expiration | ||
optional: true | ||
type: oneof | ||
- arguments: | ||
- display_text: numfields | ||
name: numfields | ||
type: integer | ||
- display_text: field | ||
multiple: true | ||
name: field | ||
type: string | ||
name: fields | ||
token: FIELDS | ||
type: block | ||
arity: -5 | ||
categories: | ||
- docs | ||
- develop | ||
- stack | ||
- oss | ||
- rs | ||
- rc | ||
- oss | ||
- kubernetes | ||
- clients | ||
command_flags: | ||
- write | ||
- fast | ||
complexity: O(N) where N is the number of specified fields | ||
description: Get the value of one or more fields of a given hash key, and optionally | ||
set their expiration. | ||
group: hash | ||
hidden: false | ||
key_specs: | ||
- RW: true | ||
access: true | ||
begin_search: | ||
spec: | ||
index: 1 | ||
type: index | ||
find_keys: | ||
spec: | ||
keystep: 1 | ||
lastkey: 0 | ||
limit: 0 | ||
type: range | ||
notes: RW and UPDATE because it changes the TTL | ||
update: true | ||
linkTitle: HGETEX | ||
since: 8.0.0 | ||
summary: Get the value of one or more fields of a given hash key, and optionally set | ||
their expiration. | ||
syntax_fmt: "HGETEX key [EX\_seconds | PX\_milliseconds | EXAT\_unix-time-seconds\ | ||
\ |\n PXAT\_unix-time-milliseconds | PERSIST] FIELDS\_numfields field\n [field\ | ||
\ ...]" | ||
syntax_str: "[EX\_seconds | PX\_milliseconds | EXAT\_unix-time-seconds | PXAT\_unix-time-milliseconds\ | ||
\ | PERSIST] FIELDS\_numfields field [field ...]" | ||
title: HGETEX | ||
--- | ||
Get the value of one or more fields of a given hash key and optionally set their expirations (time-to-live or TTL). | ||
|
||
## Options | ||
|
||
The `HGETEX` command supports a set of options: | ||
|
||
* `EX seconds` -- Set the specified expiration time, in seconds. | ||
* `PX milliseconds` -- Set the specified expiration time, in milliseconds. | ||
* `EXAT unix-time-seconds` -- Set the specified Unix time at which the field will expire, in seconds. | ||
dwdougherty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* `PXAT unix-time-milliseconds` -- Set the specified Unix time at which the field will expire, in milliseconds. | ||
* `PERSIST` -- Remove the TTL associated with the field. | ||
|
||
The `EX`, `PX`, `EXAT`, `PXAT`, and `PERSIST` options are mutually exclusive. | ||
|
||
## Example | ||
|
||
``` | ||
redis> HSET mykey field1 "Hello" field2 "World" | ||
(integer) 2 | ||
redis> HGETEX mykey EX 120 FIELDS 1 field1 | ||
1) "Hello" | ||
redis> HGETEX mykey EX 100 FIELDS 1 field2 | ||
1) "World" | ||
redis> HTTL mykey FIELDS 2 field1 field2 | ||
1) (integer) 91 | ||
2) (integer) 85 | ||
redis> HTTL mykey FIELDS 3 field1 field2 field3 | ||
1) (integer) 75 | ||
2) (integer) 68 | ||
3) (integer) -2 | ||
... | ||
redis> HTTL mykey FIELDS 3 field1 field2 | ||
1) (integer) -2 | ||
2) (integer) -2 | ||
redis> HGETALL mykey | ||
(empty array) | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.