|
| 1 | +--- |
| 2 | +acl_categories: |
| 3 | +- '@write' |
| 4 | +- '@string' |
| 5 | +- '@slow' |
| 6 | +arguments: |
| 7 | +- display_text: numkeys |
| 8 | + name: numkeys |
| 9 | + type: integer |
| 10 | +- arguments: |
| 11 | + - display_text: key |
| 12 | + key_spec_index: 0 |
| 13 | + name: key |
| 14 | + type: key |
| 15 | + - display_text: value |
| 16 | + name: value |
| 17 | + type: string |
| 18 | + multiple: true |
| 19 | + name: data |
| 20 | + type: block |
| 21 | +- arguments: |
| 22 | + - display_text: nx |
| 23 | + name: nx |
| 24 | + token: NX |
| 25 | + type: pure-token |
| 26 | + - display_text: xx |
| 27 | + name: xx |
| 28 | + token: XX |
| 29 | + type: pure-token |
| 30 | + name: condition |
| 31 | + optional: true |
| 32 | + type: oneof |
| 33 | +- arguments: |
| 34 | + - display_text: seconds |
| 35 | + name: seconds |
| 36 | + token: EX |
| 37 | + type: integer |
| 38 | + - display_text: milliseconds |
| 39 | + name: milliseconds |
| 40 | + token: PX |
| 41 | + type: integer |
| 42 | + - display_text: unix-time-seconds |
| 43 | + name: unix-time-seconds |
| 44 | + token: EXAT |
| 45 | + type: unix-time |
| 46 | + - display_text: unix-time-milliseconds |
| 47 | + name: unix-time-milliseconds |
| 48 | + token: PXAT |
| 49 | + type: unix-time |
| 50 | + - display_text: keepttl |
| 51 | + name: keepttl |
| 52 | + token: KEEPTTL |
| 53 | + type: pure-token |
| 54 | + name: expiration |
| 55 | + optional: true |
| 56 | + type: oneof |
| 57 | +arity: -4 |
| 58 | +categories: |
| 59 | +- docs |
| 60 | +- develop |
| 61 | +- stack |
| 62 | +- oss |
| 63 | +- rs |
| 64 | +- rc |
| 65 | +- oss |
| 66 | +- kubernetes |
| 67 | +- clients |
| 68 | +command_flags: |
| 69 | +- write |
| 70 | +- denyoom |
| 71 | +- movablekeys |
| 72 | +complexity: O(N) where N is the number of keys to set. |
| 73 | +description: Atomically sets multiple string keys with a shared expiration in a single |
| 74 | + operation. Supports flexible argument parsing where condition and expiration flags |
| 75 | + can appear in any order. |
| 76 | +group: string |
| 77 | +hidden: false |
| 78 | +hints: |
| 79 | +- request_policy:multi_shard |
| 80 | +- response_policy:all_succeeded |
| 81 | +key_specs: |
| 82 | +- OW: true |
| 83 | + begin_search: |
| 84 | + spec: |
| 85 | + index: 1 |
| 86 | + type: index |
| 87 | + find_keys: |
| 88 | + spec: |
| 89 | + firstkey: 1 |
| 90 | + keynumidx: 0 |
| 91 | + keystep: 2 |
| 92 | + type: keynum |
| 93 | + update: true |
| 94 | +linkTitle: MSETEX |
| 95 | +since: 8.4.0 |
| 96 | +summary: Atomically sets multiple string keys with a shared expiration in a single |
| 97 | + operation. Supports flexible argument parsing where condition and expiration flags |
| 98 | + can appear in any order. |
| 99 | +syntax_fmt: "MSETEX numkeys key value [key value ...] [NX | XX] [EX\_seconds |\n \ |
| 100 | + \ PX\_milliseconds | EXAT\_unix-time-seconds |\n PXAT\_unix-time-milliseconds |\ |
| 101 | + \ KEEPTTL]" |
| 102 | +syntax_str: "key value [key value ...] [NX | XX] [EX\_seconds | PX\_milliseconds |\ |
| 103 | + \ EXAT\_unix-time-seconds | PXAT\_unix-time-milliseconds | KEEPTTL]" |
| 104 | +title: MSETEX |
| 105 | +--- |
| 106 | +Atomically sets multiple string keys with an optional shared expiration in a single operation. Supports flexible argument parsing where condition and expiration flags can appear in any order. |
| 107 | + |
| 108 | +## Required arguments |
| 109 | + |
| 110 | +<details open><summary><code>numkeys</code></summary> |
| 111 | + |
| 112 | +The number of keys being set. |
| 113 | + |
| 114 | +</details> |
| 115 | + |
| 116 | +<details open><summary><code>key value [key value ...]</code></summary> |
| 117 | + |
| 118 | +A series of key/value pairs. |
| 119 | + |
| 120 | +</details> |
| 121 | + |
| 122 | +## Optional arguments |
| 123 | + |
| 124 | +<details open><summary><code>condition and expiration flags</code></summary> |
| 125 | + |
| 126 | +The `MSETEX` command supports a set of options that modify its behavior: |
| 127 | + |
| 128 | +* `EX seconds` -- Set the specified expiration time in seconds (a positive integer). |
| 129 | +* `PX milliseconds` -- Set the specified expiration time in milliseconds (a positive integer). |
| 130 | +* `EXAT unix-time-seconds` -- Set the specified Unix time in seconds (a positive integer) at which the key(s) will expire. |
| 131 | +* `PXAT unix-time-milliseconds` -- Set the specified Unix time in milliseconds (a positive integer) at which the key(s) will expire. |
| 132 | +* `NX` -- Set the keys and their expiration time only if none of the specified keys exist. |
| 133 | +* `XX` -- Set the keys and their expiration time only if all of the specified keys already exist. |
| 134 | +* `KEEPTTL` -- Retain the time to live associated with the keys. |
| 135 | + |
| 136 | +</details> |
| 137 | + |
| 138 | +## Return information |
| 139 | + |
| 140 | +{{< multitabs id="return-info" |
| 141 | + tab1="RESP2" |
| 142 | + tab2="RESP3" >}} |
| 143 | + |
| 144 | +[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): 0 if none of the keys were set; 1 if all of the keys were set. |
| 145 | + |
| 146 | +-tab-sep- |
| 147 | + |
| 148 | +[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): 0 if none of the keys were set; 1 if all of the keys were set. |
| 149 | + |
| 150 | +{{< /multitabs >}} |
0 commit comments