Set offset and limit in zScan Redis

1k views Asked by At

I have this code on PHP redis: (https://github.com/phpredis/phpredis)

$count = 10;
$it = null;
$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_RETRY);
$pattern = '*"regionId":"564"*';
$result = $redis->zScan('my_key', $it, $pattern, $count);

I want to set offset using zScan. Is it possible? Is there any workaround for doing this?

1

There are 1 answers

0
Itamar Haber On

No - the SCAN family of commands use a stateless (server-wise) cursor to iterate the data structure that always starts at "0" (arbitrary, not related to offset). An offset, whatever you mean by that, is not included in the API.

It would be better if your question was to describe the use case and requirements - it isn't clear what you're trying to achieve.