MSETEX

MSETEX numkeys key value [key value ...] [NX | XX] [EX seconds |
  PX milliseconds | EXAT unix-time-seconds |
  PXAT unix-time-milliseconds | KEEPTTL]
Available since:
Redis Open Source 8.4.0
Time complexity:
O(N) where N is the number of keys to set.
ACL categories:
@write, @string, @slow,
Compatibility:
Redis Software and Redis Cloud compatibility

Atomically sets multiple string keys with an optional shared expiration in a single operation.

Required arguments

numkeys

The number of keys being set.

key value [key value ...]

A series of key/value pairs.

Optional arguments

The following options modify the command's behavior. The condition options (NX, XX) are mutually exclusive, as are the expiration options (EX, PX, EXAT, PXAT, KEEPTTL).

NX

Set the keys and their expiration time only if none of the specified keys exist.

XX

Set the keys and their expiration time only if all of the specified keys already exist.

EX seconds

Set the specified expiration time in seconds (a positive integer).

PX milliseconds

Set the specified expiration time in milliseconds (a positive integer).

EXAT unix-time-seconds

Set the specified Unix time in seconds (a positive integer) at which the keys will expire.

PXAT unix-time-milliseconds

Set the specified Unix time in milliseconds (a positive integer) at which the keys will expire.

KEEPTTL

Retain the time to live associated with the keys.

Redis Software and Redis Cloud compatibility

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

Return information

Integer reply: 0 if none of the keys were set; 1 if all of the keys were set.
RATE THIS PAGE
Back to top ↑