hpersist.3valkey - Man Page
Remove the existing expiration on a hash key’s field(s).
Synopsis
HPERSIST key FIELDS numfields field [field...]
Description
The HPERSIST remove the existing expiration on a hash key’s field(s), turning the field(s) from volatile (a field with expiration set) to persistent (a field that will never expire as no TTL (time to live) is associated).
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.
- -2: Field does not exist in the provided hash key, or the hash key does not exist.
- -1: Field exists in the provided hash key, but has no expiration associated with it.
- 1: The expiration time was removed from the hash key field.
Complexity
O(1) for each field assigned with TTL, so O(N) to persist N items when the command is called with multiple fields.
Acl Categories
@fast @hash @write
History
- Available since: 9.0.0
Examples
127.0.0.1:6379> HSET myhash f1 v1 f2 v2 f3 v3 (integer) 3 27.0.0.1:6379> HEXPIRE myhash 1000 FIELDS 2 f2 f3 1) (integer) 1 2) (integer) 1 127.0.0.1:6379> HTTL myhash FIELDS 3 f1 f2 f3 1) (integer) -1 2) (integer) 998 3) (integer) 998 127.0.0.1:6379> HPERSIST myhash FIELDS 3 f1 f2 f3 1) (integer) -1 2) (integer) 1 3) (integer) 1 127.0.0.1:6379> HTTL myhash FIELDS 3 f1 f2 f3 1) (integer) -1 2) (integer) -1 3) (integer) -1
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), hpexpire(3valkey), hpexpireat(3valkey), hpexpiretime(3valkey), hpttl(3valkey), hrandfield(3valkey), hscan(3valkey), hset(3valkey), hsetex(3valkey), hsetnx(3valkey), hstrlen(3valkey), httl(3valkey), hvals(3valkey)