SPERSIST

SPERSIST key MEMBERS nummembers member [member ...]
Available since:
Redis Open Source 8.12.0
Time complexity:
O(N) where N is the number of specified members
ACL categories:
@write, @set, @fast,
Compatibility:
Redis Software and Redis Cloud compatibility

Removes the existing expiration from one or more set members. This turns each member from volatile (a member with an expiration) back into persistent (a member with no TTL, which never expires).

Required arguments

key

The name of the key that holds the set.

MEMBERS nummembers member [member ...]

The set members to remove the expiration from. nummembers is the number of members, followed by that many member names.

Examples

redis> SADD myset member1 member2
(integer) 2
redis> SEXPIRE myset 300 MEMBERS 2 member1 member2
1) (integer) 1
2) (integer) 1
redis> SPERSIST myset MEMBERS 1 member2
1) (integer) 1
redis> STTL myset MEMBERS 2 member1 member2
1) (integer) 300
2) (integer) -1
redis> SPERSIST myset MEMBERS 2 member2 member3
1) (integer) -1
2) (integer) -2

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
❌ Standard
❌ Active-Active
❌ Standard
❌ Active-Active

Return information

  • Array reply. For each member:
    • Integer reply: -2 if no such member exists in the set, or the key does not exist.
    • Integer reply: -1 if the member exists but has no associated expiration.
    • Integer reply: 1 if the expiration was removed.
  • Simple error reply:
    • if parsing failed, mandatory arguments are missing, unknown arguments are specified, or argument values are of the wrong type or out of range.
    • if the key exists but is not a set.

See also

SEXPIRE | SPEXPIRE | SEXPIREAT | SPEXPIREAT | SADDEX | STTL | SPTTL | SEXPIRETIME | SPEXPIRETIME

RATE THIS PAGE
Back to top ↑