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

✨ Add SINTERCARD #1201

Closed
wants to merge 1 commit into from
Closed

Conversation

JerrodCarpenter
Copy link
Contributor

=> #<Redis client v5.0.6 for redis://localhost:6379/2>
irb(main):002:0> redis.sadd("key1", "a")
=> 1
irb(main):003:0> redis.sadd("key1", "b", "c", "d", "e")
=> 4
irb(main):004:0> redis.sadd("key2", "c", "d", "f")
=> 3
irb(main):005:0> redis.sinter("key1", "key2")
=> ["c", "d"]
irb(main):006:0> redis.sintercard("key1", "key2")
=> 2
irb(main):007:0> redis.sintercard("key1", "key2", limit: 1)
=> 1

@JerrodCarpenter JerrodCarpenter force-pushed the SINTERCARD branch 3 times, most recently from 9f515ab to c73f1ab Compare June 10, 2023 12:44
# This command is similar to SINTER, but instead of returning the result set,
# it returns just the cardinality of the result.
def sintercard(*keys, limit: nil)
keys.flatten!(1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you support both sintercard("key1", "key2") and sintercard(["key1", "key2"]) that should be tested.

@byroot byroot mentioned this pull request Jun 12, 2023
#
# @param [String, Array<String>] keys keys pointing to sets to intersect
# @param [Interger] limits number of matches searched for
# @return [Array<String>] cardinality of the intersection
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it return Integer type?
Seems to need changing it

Suggested change
# @return [Array<String>] cardinality of the intersection
# @return [Integer] cardinality of the intersection

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

3 participants