Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 520e06a commit f0c25a2Copy full SHA for f0c25a2
1 file changed
README.markdown
@@ -1013,13 +1013,14 @@ _**Description**_: Scan the keyspace for keys
1013
##### *Example*
1014
~~~
1015
$it = NULL; /* Initialize our iterator to NULL */
1016
-$redis->setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY); /* retry when we get no keys back */
1017
-while($arr_keys = $redis->scan($it)) {
+do {
+ // Use global option $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY); to ignore empty results
1018
+ $arr_keys = $redis->scan($it);
1019
foreach($arr_keys as $str_key) {
1020
echo "Here is a key: $str_key\n";
1021
}
- echo "No more keys to scan!\n";
1022
-}
+} while ($it > 0);
1023
+echo "No more keys to scan!\n";
1024
1025
1026
### object
0 commit comments