New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZRANGEBYLEX and ZREVRANGEBYLEX commands support #135
ZRANGEBYLEX and ZREVRANGEBYLEX commands support #135
Conversation
range = get_range start, stop, sorted.first, sorted.last | ||
|
||
filtered = [] | ||
sorted.each do |element| |
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.
instead of traversing the sorted
array, maybe you could use Array#bsearch
for searching the beginning and ending positions.
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.
good point. I'll take a look asap
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.
@larrylv
I don't think #bsearch
is suitable there. I don't find border elements there, I check each element for range condition.
I handle begin and end positions there
https://github.com/guilleiguaran/fakeredis/pull/135/files#diff-dd66f1d97e61bf36103779390dbe90c9R975
* master: fix doc that minitest is not rspec Return correct 1 or 0 for hash set functions hscan method returns empty array when key is not found add hscan method return 0 for lrem if key does not exist (as expected - http://redis.io/commands/lrem) fix namespace conflict for minitest add zscan_each + specs refactor key-value sorting into method add zscan + specs Stub Time.now when checking key expiry time in ms Update expiry conditional to be inclusive yeah, thats nicer adding guard add fake blocking User correct redis-rb repo Add BITOP command Add support for Minitest configuration. disallow pushing empty list of objects
ZRANGEBYLEX and ZREVRANGEBYLEX commands support
Thanks! |
Hi. I added support to 2 new commands
Also stable redis-rb doesn't support all these features well (see redis/redis-rb#492)
Comments are welcome