setex, psetex
Description
Set the string value in argument as value of the key, with a time to live. PSETEX uses a TTL in milliseconds.
设置一个有生命周期的KEY-VALUE,psetex()使用的周期单位为毫秒。
Parameters
Key TTL Value
Return value
Bool TRUE
if the command is successful.
Examples
$redis->setex('key', 3600, 'value'); // sets key → value, with 1h TTL. $redis->psetex('key', 100, 'value'); // sets key → value, with 0.1 sec TTL.