Description
Sets multiple key-value pairs in one atomic command. MSETNX only returns TRUE if all the keys were set (see SETNX).
批量设置多个KEY-VALUE。如果所有的KEYS都被设置成功,如果这些KEY-VALUE都SET成功,使用msetnx将仅仅返回一个TURE,而如果有一个是已经存在的KEY,则所有的操作都不被执行。
Parameters
Pairs: array(key => value, ...)
Return value
Bool TRUE in case of success, FALSE in case of failure.
Example
$redis->mset(array('key0' => 'value0', 'key1' => 'value1'));
var_dump($redis->get('key0'));
var_dump($redis->get('key1'));
Output:
string(6) "value0"
string(6) "value1"