diff options
Diffstat (limited to '')
-rw-r--r-- | iredis/data/commands/setex.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/iredis/data/commands/setex.md b/iredis/data/commands/setex.md new file mode 100644 index 0000000..6181b73 --- /dev/null +++ b/iredis/data/commands/setex.md @@ -0,0 +1,27 @@ +Set `key` to hold the string `value` and set `key` to timeout after a given +number of seconds. This command is equivalent to executing the following +commands: + +``` +SET mykey value +EXPIRE mykey seconds +``` + +`SETEX` is atomic, and can be reproduced by using the previous two commands +inside an `MULTI` / `EXEC` block. It is provided as a faster alternative to the +given sequence of operations, because this operation is very common when Redis +is used as a cache. + +An error is returned when `seconds` is invalid. + +@return + +@simple-string-reply + +@examples + +```cli +SETEX mykey 10 "Hello" +TTL mykey +GET mykey +``` |