Strings Setex
# Redis SETEX Command
[!(#) Redis Strings](#)
The Redis SETEX command sets the value of a key along with its expiration time. If the key already exists, the SETEX command will overwrite the old value.
### Syntax
The basic syntax of the Redis SETEX command is as follows:
redis 127.0.0.1:6379> SETEX KEY_NAME TIMEOUT VALUE
### Available Versions
>= 2.0.0
### Return Value
Returns OK if the operation succeeds.
### Example
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
[!(#) Redis Strings](#)
YouTip