PredisClusterConnection.php 600 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace Illuminate\Redis\Connections;
  3. use Predis\Command\Redis\FLUSHDB;
  4. use Predis\Command\ServerFlushDatabase;
  5. class PredisClusterConnection extends PredisConnection
  6. {
  7. /**
  8. * Flush the selected Redis database on all cluster nodes.
  9. *
  10. * @return void
  11. */
  12. public function flushdb()
  13. {
  14. $command = class_exists(ServerFlushDatabase::class)
  15. ? ServerFlushDatabase::class
  16. : FLUSHDB::class;
  17. foreach ($this->client as $node) {
  18. $node->executeCommand(tap(new $command)->setArguments(func_get_args()));
  19. }
  20. }
  21. }