content/commands/setex.md
Set key to hold the string value and set key to timeout after a given
number of seconds.
This command is equivalent to:
SET key value EX seconds
An error is returned when seconds is invalid.
{{% redis-cli %}} SETEX mykey 10 "Hello" TTL mykey GET mykey {{% /redis-cli %}}
[TTL]({{< relref "/commands/ttl" >}})
| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |
{{< multitabs id="setex-return-info" tab1="RESP2" tab2="RESP3" >}}
Simple string reply: OK.
-tab-sep-
Simple string reply: OK.
{{< /multitabs >}}