w3resource

Redis String: SETEX

SETEX key seconds value

The Redis SETEX command is used to set some string value with specified timeout in seconds in redis key.

Syntax:

SETEX KEY_NAME TIMEOUT VALUE

Available since

2.0.0.

Return Value

Simple string reply. OK, if the value is set to key or Null if the value does not set.

Return Value Type

String

Example: Redis SETEX

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

Previous: SETBIT
Next: SETNX



Follow us on Facebook and Twitter for latest update.