hexpiretime.3valkey - Man Page

Returns Unix timestamps in seconds since the epoch at which the given key’s field(s) will expire

Synopsis

HEXPIRETIME key FIELDS numfields field [field...]

Description

The HEXPIRETIME command returns the absolute Unix timestamp (since January 1, 1970) in seconds at which the given hash field(s) will expire or -1 if the hash field doesn’t have expiration time.

See also the valkey-hpexpiretime(7) HPEXPIRETIME command that returns the same information with milliseconds resolution.

Reply

valkey-protocol(7) Array reply: a list of values associated with the result of getting the absolute expiry timestamp of the specific fields, in the same order as they are requested.

Complexity

O(1) for each field, so O(N) for N items when the command is called with multiple fields.

Acl Categories

@fast @hash @read

History

Examples

127.0.0.1:6379> HSET myhash f1 v1 f2 v2 f3 v3
(integer) 3
27.0.0.1:6379> HEXPIREAT myhash 1754846600 FIELDS 2 f2 f3
1) (integer) 1
2) (integer) 1
127.0.0.1:6379> HEXPIRETIME myhash FIELDS 4 f1 f2 f3 non-exist
1) (integer) -1
2) (integer) 1754846600
3) (integer) 1754846600
4) (integer) -2

See Also

hdel(3valkey), hexists(3valkey), hexpire(3valkey), hexpireat(3valkey), hget(3valkey), hgetall(3valkey), hgetex(3valkey), hincrby(3valkey), hincrbyfloat(3valkey), hkeys(3valkey), hlen(3valkey), hmget(3valkey), hmset(3valkey), hpersist(3valkey), hpexpire(3valkey), hpexpireat(3valkey), hpexpiretime(3valkey), hpttl(3valkey), hrandfield(3valkey), hscan(3valkey), hset(3valkey), hsetex(3valkey), hsetnx(3valkey), hstrlen(3valkey), httl(3valkey), hvals(3valkey)

Info

2025-10-21 9.0.0 Valkey Command Manual