9951 explained code solutions for 126 technologies


php-redisRedis scan example


while( $it !== 0 ) {
  foreach ( $redis->scan($it, 't*') as $k) {
    # do something with $k
  }
}ctrl + c
while( $it !== 0 )

we should call scan till returned iterator is not zero

$redis

Redis object after connection

scan

scans keys based on specified pattern and returns iterator

't*'

sample pattern to search keys (in this case, all keys starting with t)

$it

iterator object