HEXPIRETIME
HEXPIRETIME key FIELDS numfields field [field ...]
- Available since:
- Redis Open Source 7.4.0
- Time complexity:
- O(N) where N is the number of specified fields
- ACL categories:
-
@read,@hash,@fast, - Compatibility:
- Redis Software and Redis Cloud compatibility
Returns the absolute Unix timestamp in seconds since Unix epoch at which the given key's field(s) will expire.
See also the HPEXPIRETIME command, which returns the same information with millisecond resolution.
Required arguments
key
The name of the key that holds the hash.
FIELDS numfields field [field ...]
The hash fields to retrieve the expiration time for. numfields is the number of fields, followed by that many field names.
Examples
redis> HSET mykey field1 "hello" field2 "world"
(integer) 2
redis> HEXPIRE mykey 300 FIELDS 2 field1 field2
1) (integer) 1
2) (integer) 1
redis> HEXPIRETIME mykey FIELDS 2 field1 field2
1) (integer) 1715705914
2) (integer) 1715705914
Redis Software and Redis Cloud compatibility
| Redis Software |
Redis Cloud |
Notes |
|---|---|---|
| ✅ Standard |
✅ Standard |
Return information
- Array reply. For each field:
- Integer reply:
-2if no such field exists in the provided hash key, or the provided key does not exist. - Integer reply:
-1if the field exists but has no associated expiration set. - Integer reply: the expiration (Unix timestamp) in seconds.
- Integer reply: