12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace Predis\Pipeline;
- use SplQueue;
- use Predis\Connection\ConnectionInterface;
- use Predis\Connection\ReplicationConnectionInterface;
- class FireAndForgetExecutor implements PipelineExecutorInterface
- {
-
- protected function checkConnection(ConnectionInterface $connection)
- {
- if ($connection instanceof ReplicationConnectionInterface) {
- $connection->switchTo('master');
- }
- }
-
- public function execute(ConnectionInterface $connection, SplQueue $commands)
- {
- $this->checkConnection($connection);
- while (!$commands->isEmpty()) {
- $connection->writeCommand($commands->dequeue());
- }
- $connection->disconnect();
- return array();
- }
- }
|