[フレーム]
Docs Pricing
Login Book a meeting Try Redis

HGETEX

Syntax
HGETEX key [EX seconds | PX milliseconds | EXAT unix-time-seconds |
 PXAT unix-time-milliseconds | PERSIST] FIELDS numfields field
 [field ...]
Available since:
Redis Open Source 8.0.0
Time complexity:
O(N) where N is the number of specified fields
ACL categories:
@write, @hash, @fast,
Compatibility:
Redis Enterprise and Redis Cloud compatibility

Get the value of one or more fields of a given hash key and optionally set their expiration time or time-to-live (TTL).

Options

The HGETEX command supports a set of options:

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)

Redis Enterprise and Redis Cloud compatibility

Redis
Enterprise
Redis
Cloud
Notes
✅ Standard
✅ Active-Active
✅ Standard
✅ Active-Active

Return information

  • Array reply: a list of values associated with the given fields, in the same order as they are requested.
RATE THIS PAGE
Back to top ↑

AltStyle によって変換されたページ (->オリジナル) /