-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
5 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f0c25a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scan
may returnsfalse
and then you pass it toforeach
f0c25a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really shouldn't merge things before I have had coffee. FFS I'm the one who wrote the SCAN implementation too. I have no excuse 😃
Edit: Although, without a MATCH argument I don't think Redis ever returns empty results. It's only when you MATCH that this can happen.
f0c25a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm glad @yatsukhnenko commented on that. I took that into account in my project but forgot to add it to the issue.
Shortest: (Not 100% sure this works, and not very pretty)
$arr_keys = $redis->scan($it) || continue;Yeah this doesn't work. "Expected: expression"
Bestest:
What people will end up writing:
f0c25a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically I just set the Redis::SCAN_RETRY option so I never have to deal with it at all.
Now it's documented both ways so I think we've got our bases covered. 😀