2022-12-24 22:10:40 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Illuminate\Redis\Connections;
|
|
|
|
|
2024-01-31 22:15:08 +08:00
|
|
|
use Predis\Command\Redis\FLUSHDB;
|
2022-12-24 22:10:40 +08:00
|
|
|
use Predis\Command\ServerFlushDatabase;
|
|
|
|
|
|
|
|
class PredisClusterConnection extends PredisConnection
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Flush the selected Redis database on all cluster nodes.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function flushdb()
|
|
|
|
{
|
2024-01-31 22:15:08 +08:00
|
|
|
$command = class_exists(ServerFlushDatabase::class)
|
|
|
|
? ServerFlushDatabase::class
|
|
|
|
: FLUSHDB::class;
|
|
|
|
|
|
|
|
foreach ($this->client as $node) {
|
|
|
|
$node->executeCommand(tap(new $command)->setArguments(func_get_args()));
|
|
|
|
}
|
2022-12-24 22:10:40 +08:00
|
|
|
}
|
|
|
|
}
|