SPEXPIRETIME

SPEXPIRETIME 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

This command works like SEXPIRETIME, but returns the absolute Unix expiration timestamp of each member in milliseconds instead of seconds.

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> SPEXPIRE myset 300000 MEMBERS 1 member1
1) (integer) 1
redis> SPEXPIRETIME myset MEMBERS 3 member1 member2 member3
1) (integer) 1792684427589
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 milliseconds.
  • 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 | SPERSIST

RATE THIS PAGE
Back to top ↑