Latest web development tutorials

Redis Setex command

Redis string (string)

Redis Setex command for the specified key settings and their expiration time. If the key already exists, SETEX command will replace the old values.

grammar

redis Setex basic command syntax is as follows:

redis 127.0.0.1:6379> SETEX KEY_NAME TIMEOUT VALUE

Available versions

> = 2.0.0

return value

Back OK when setting success.

Examples

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 string (string)