protected function setValues($data, $expire)
{
$args = [];
foreach ($data as $key => $value) {
$args[] = $key;
$args[] = $value;
}
$failedKeys = [];
if ($expire == 0) {
$this->redis->executeCommand('MSET', $args);
} else {
$expire = (int) ($expire * 1000);
$this->redis->executeCommand('MULTI');
$this->redis->executeCommand('MSET', $args);
$index = [];
foreach ($data as $key => $value) {
$this->redis->executeCommand('PEXPIRE', [$key, $expire]);
$index[] = $key;
}
$result = $this->redis->executeCommand('EXEC');
array_shift($result);
foreach ($result as $i => $r) {
if ($r != 1) {
$failedKeys[] = $index[$i];
}
}
}
return $failedKeys;
}