123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace Predis\Pipeline;
- use Predis\Network\IConnection;
- use Predis\Network\IConnectionReplication;
- class FireAndForgetExecutor implements IPipelineExecutor
- {
-
- protected function checkConnection(IConnection $connection)
- {
- if ($connection instanceof IConnectionReplication) {
- $connection->switchTo('master');
- }
- }
-
- public function execute(IConnection $connection, &$commands)
- {
- $this->checkConnection($connection);
- foreach ($commands as $command) {
- $connection->writeCommand($command);
- }
- $connection->disconnect();
- return array();
- }
- }
|