hpexpire.3valkey - Man Page

Set expiry time on hash object.

Synopsis

HPEXPIRE key milliseconds [NX | XX | GT | LT] FIELDS numfields field [field...]

Description

This command works exactly like valkey-hexpire(7) HEXPIRE but the time to live of the key is specified in milliseconds instead of seconds. Note, that providing a millisecond time of `0' will cause immediate expiration and reclamation of the field(s).

Options

The HPXPIRE command supports a set of options that modify its behavior:

Reply

valkey-protocol(7) Array reply: a list of integer codes indicating the result of setting expiry on each specified field, in the same order as the fields are requested.

Complexity

O(N) where N is the number of specified fields.

Acl Categories

@fast @hash @write

History

Examples

127.0.0.1:6379> HSET myhash f1 v1 f2 v2 f3 v3
(integer) 3
27.0.0.1:6379> HPEXPIRE myhash 10000 FIELDS 2 f2 f3
1) (integer) 1
2) (integer) 1
127.0.0.1:6379> HPTTL myhash FIELDS 3 f1 f2 f3
1) (integer) -1
2) (integer) 9597
3) (integer) 9597

See Also

hdel(3valkey), hexists(3valkey), hexpire(3valkey), hexpireat(3valkey), hexpiretime(3valkey), hget(3valkey), hgetall(3valkey), hgetex(3valkey), hincrby(3valkey), hincrbyfloat(3valkey), hkeys(3valkey), hlen(3valkey), hmget(3valkey), hmset(3valkey), hpersist(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