public function multi() { return $this->startMulti(MultiMode::MULTI()); }
/** * Helper method which starts multi mode. * * @param MultiMode $mode * @return bool */ private function startMultiMode(MultiMode $mode) { $nativeMode = null; // didn't know that it's possible to call switch on an object switch ($mode) { case MultiMode::STREAM(): // as we don't have much influence into what the phpredis extension does during pipeline mode // we just treat stream mode as regular pipeline mode, but set the variable // as we don't have much influence into what the phpredis extension does during pipeline mode // we just treat stream mode as regular pipeline mode, but set the variable case MultiMode::PIPELINE(): $nativeMode = \Redis::PIPELINE; break; case MultiMode::MULTI(): $nativeMode = \Redis::MULTI; break; } $ret = $this->redis->multi($nativeMode); if (!$ret) { return false; } $this->inMultiMode = true; $this->isStreamMode = $mode->equals(MultiMode::STREAM); return true; }