SEXPIRETIME

SEXPIRETIME 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:
@read, @set, @fast,
Compatibility:
Redis Software and Redis Cloud compatibility

Returns the absolute Unix timestamp, in seconds since the Unix epoch, at which one or more set members expire.

See also the SPEXPIRETIME command, which returns the same information with millisecond resolution.

Required arguments

key

The name of the key that holds the set.

MEMBERS nummembers member [member ...]

The set members to retrieve the expiration time for. 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 1 member1
1) (integer) 1
redis> SEXPIRETIME myset MEMBERS 3 member1 member2 member3
1) (integer) 1792684428
2) (integer) -1
3) (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: the expiration time, as a Unix timestamp in seconds.
  • 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 | SPEXPIRETIME | SPERSIST

RATE THIS PAGE
Back to top ↑