PHP 8.3.31
Preview: PhpRedisClusterConnection.php Size: 1.88 KB
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisClusterConnection.php

<?php

namespace Illuminate\Redis\Connections;

use InvalidArgumentException;

class PhpRedisClusterConnection extends PhpRedisConnection
{
    /**
     * The RedisCluster client.
     *
     * @var \RedisCluster
     */
    protected $client;

    /**
     * The default node to use from the cluster.
     *
     * @var string|array
     */
    protected $defaultNode;

    /**
     * Scan all keys based on the given options.
     *
     * @param  mixed  $cursor
     * @param  array  $options
     * @return mixed
     *
     * @throws \InvalidArgumentException
     */
    #[\Override]
    public function scan($cursor, $options = [])
    {
        $result = $this->client->scan($cursor,
            $options['node'] ?? $this->defaultNode(),
            $options['match'] ?? '*',
            $options['count'] ?? 10
        );

        if ($result === false) {
            $result = [];
        }

        return $cursor === 0 && empty($result) ? false : [$cursor, $result];
    }

    /**
     * Flush the selected Redis database on all master nodes.
     *
     * @return void
     */
    public function flushdb()
    {
        $arguments = func_get_args();

        $async = strtoupper((string) ($arguments[0] ?? null)) === 'ASYNC';

        foreach ($this->client->_masters() as $master) {
            $async
                ? $this->command('rawCommand', [$master, 'flushdb', 'async'])
                : $this->command('flushdb', [$master]);
        }
    }

    /**
     * Return default node to use for cluster.
     *
     * @return string|array
     *
     * @throws \InvalidArgumentException
     */
    private function defaultNode()
    {
        if (! isset($this->defaultNode)) {
            $this->defaultNode = $this->client->_masters()[0] ?? throw new InvalidArgumentException('Unable to determine default node. No master nodes found in the cluster.');
        }

        return $this->defaultNode;
    }
}

Directory Contents

Dirs: 0 × Files: 6

Name Size Perms Modified Actions
5.08 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
6.35 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
1.88 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
14.03 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
600 B lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
1.70 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).