*/ public $commands = []; /** * Creates a new transaction instance. * * @param \RedisCachePro\Clients\ClientInterface $client * @param mixed $context * @return void */ public function __construct(ClientInterface $client, $context) { $this->client = $client; $this->context = $context; } /** * Memorize all method calls for later execution. * * @param string $method * @param array $arguments * @return mixed */ public function __call($method, $arguments) { $this->commands[] = [$method, $arguments]; return $this; } /** * Executes the transaction on the underlying client. * * @return array|bool */ public function exec() { if (! method_exists($this->client, 'executeBufferedTransaction')) { throw new LogicException('Client does not implement `executeBufferedTransaction()` method'); } return $this->client->executeBufferedTransaction($this); } /** * Block nested pipelines. * * @return void */ public function pipeline() { throw new LogicException('Nested pipelines are not supported'); } /** * Block nested MULTI transactions. * * @return void */ public function multi() { throw new LogicException('Nested `MULTI` transactions are not supported'); } }