Redis - String Psetex Command



Redis PSETEX command is used to set the value of a key, with expiration of time in milliseconds.

Return Value

Simple string reply OK.

Syntax

Following is the basic syntax of Redis PSETEX command.

redis 127.0.0.1:6379> PSETEX key1 EXPIRY_IN_MILLISECONDS value1

Example

redis 127.0.0.1:6379> PSETEX mykey 1000 "Hello" 
OK 
redis 127.0.0.1:6379> PTTL mykey 
999 
redis 127.0.0.1:6379> GET mykey 
1) "Hello"
redis_strings.htm
Advertisements