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

srem? doesn't have effect on set #226

Closed
eggplants opened this issue Jun 27, 2023 · 1 comment
Closed

srem? doesn't have effect on set #226

eggplants opened this issue Jun 27, 2023 · 1 comment

Comments

@eggplants
Copy link

eggplants commented Jun 27, 2023

Both sadd and sadd? adds a value into a set.
But I'm confused that srem? doesn't remove a value like srem. Is it correct?

RUBY_VERSION #=> "3.0.6"
Redis::VERSION #=> "4.8.1"
Redis::Namespace::VERSION #=> "1.10.0"

require "redis-namespace"
redis_connection = Redis.new(host: ENV["REDIS_HOST"], port: ENV["REDIS_PORT"])
redis = Redis::Namespace.new("Rspec Instance", redis: redis_connection)

set_key = "foo:bar"

redis.smembers set_key #=> []

redis.sadd set_key, 1 #=> true
redis.sadd? set_key, 2 #=> true
$redis.smembers set_key #=> ["1", "2"]

redis.srem set_key, 1 #=> true
redis.srem? set_key, 2 #=> false
$redis.smembers set_key #=> ["2"]

$redis.srem set_key, 2 #=> true
$redis.smembers set_key #=> []
@eggplants
Copy link
Author

It has already fixed in #224 and v1.11.0. After updating my issue was fixed.

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

No branches or pull requests

1 participant