English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Redis Setex command sets the value and expiration time for a specified key. If the key already exists, the Setex command will replace the old value.
Basic Syntax of Redis Setex Command
redis 127.0.0.1:6379> SETEX KEY_NAME TIMEOUT VALUE
>= 2.0.0
Returns OK when the setting is successful.
redis 127.0.0.1:6379> SETEX mykey 60 redis OK redis 127.0.0.1:6379> TTL mykey 60 redis 127.0.0.1:6379> GET mykey "redis