SetexCommand: Contents
SETEX _key_ _time_ _value_
Return value

# SetexCommand

ï»¿#sidebar StringCommandsSidebar

# SETEX _key_ _time_ _value_

Time complexity: O(1)

> The command is exactly equivalent to the following group of commands:

    SET _key_ _value_
    EXPIRE _key_ _time_

> The operation is atomic. An atomic SET+EXPIRE operation was already providedusing MULTI/EXEC, but SETEX is a faster alternative providedbecause this operation is very common when Redis is used as a Cache.

## Return value

Status code reply