public function scan($pattern = '*', $count = 100)
    {
        $client = $this->getConnection();
        $keys = [];

        foreach (new Keyspace($client->client(), $pattern) as $item) {
            $keys[] = $item;

            if (count($keys) == $count) {
                break;
            }
        }

        $script = <<<'LUA'
        local type = redis.call('type', KEYS[1])
        local ttl = redis.call('ttl', KEYS[1])

        return {KEYS[1], type, ttl}
LUA;

        return $client->pipeline(function (Pipeline $pipe) use ($keys, $script) {
            foreach ($keys as $key) {
                $pipe->eval($script, 1, $key);
            }
        });
    }
public function scan($pattern = '*', $count = 100)
    {
        $client = $this->getConnection();
        $keys = [];

        foreach (new Keyspace($client->client(), $pattern) as $item) {
            $keys[] = $item;

            if (count($keys) == $count) {
                break;
            }
        }

        $script = <<<'LUA'
        local type = redis.call('type', KEYS[1])
        local ttl = redis.call('ttl', KEYS[1])

        return {KEYS[1], type, ttl}
LUA;

        return $client->pipeline(function (Pipeline $pipe) use ($keys, $script) {
            foreach ($keys as $key) {
                $pipe->eval($script, 1, $key);
            }
        });
    }
public function scan ( $ pattern = '*' , $ count = 100 ) { $ client = $ this -> getConnection ( ) ; $ keys = [ ] ; foreach ( new Keyspace ( $ client -> client ( ) , $ pattern ) as $ item ) { $ keys [ ] = $ item ; if ( count ( $ keys ) == $ count ) { break ; } } $ script =  <<<'LUA'
        local type = redis.call('type', KEYS[1])
        local ttl = redis.call('ttl', KEYS[1])

        return {KEYS[1], type, ttl}
LUA ; return $ client -> pipeline ( function ( Pipeline $ pipe ) use ( $ keys , $ script ) { foreach ( $ keys as $ key ) { $ pipe -> eval ( $ script , 1 , $ key ) ; } } ) ; }
Scan keys in redis by giving pattern.

@param string $pattern
@param int    $count

@return array|\Predis\Pipeline\Pipeline
Scan keys in redis by giving pattern .