Skip to content
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

Merged
merged 6 commits into from Nov 25, 2015

Conversation

caulfield
Copy link
Contributor

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

range = get_range start, stop, sorted.first, sorted.last

filtered = []
sorted.each do |element|
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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
guilleiguaran added a commit that referenced this pull request Nov 25, 2015
ZRANGEBYLEX and ZREVRANGEBYLEX commands support
@guilleiguaran guilleiguaran merged commit 0136520 into guilleiguaran:master Nov 25, 2015
@caulfield caulfield deleted the zrangelex-commands branch November 30, 2015 09:25
@caulfield
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants