w3resource

Redis String: PSETEX key milliseconds value

Description

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

Syntax:

Basic syntax of redis PSETEX command is shown below:

redis 127.0.0.1:6379> PSETEX key1 EXPIRY_IN_MILLISECONDS value1

Available since

2.6.0.

Return Value

Simple string reply OK

Return Value Type

String

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"

Previous: MSETNX
Next: INCR



Follow us on Facebook and Twitter for latest update.