PHPDaemon\Clients\Redis\Examples\Scan::onReady PHP Метод

onReady() публичный Метод

Called when the worker is ready to go
public onReady ( ) : void
Результат void
    public function onReady()
    {
        $this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance();
        $params = [];
        foreach (range(0, 100) as $i) {
            $params[] = 'myset' . $i;
            $params[] = 'value' . $i;
        }
        $params[] = function ($redis) {
            $params = [function ($redis) {
                D('Count: ' . count($redis->result[1]) . '; Next: ' . $redis->result[0]);
            }];
            $cbEnd = function ($redis, $scan) {
                D('Full scan end!');
            };
            // test 1
            // $this->redis->scan(...$params);
            // test 2
            $this->redis->autoscan('scan', $params, $cbEnd, 50);
        };
        $this->redis->mset(...$params);
    }