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

Redis::CommandError: ERR wrong number of arguments for 'set' command #372

Closed
leckylao opened this issue Oct 16, 2013 · 6 comments
Closed

Comments

@leckylao
Copy link

on lib/redis.rb:658, it accepts options. But when I pass options it raise error.

  #   - `:ex => Fixnum`: Set the specified expire time, in seconds.
  #   - `:px => Fixnum`: Set the specified expire time, in milliseconds.
  #   - `:nx => true`: Only set the key if it does not already exist.
  #   - `:xx => true`: Only set the key if it already exist.
  # @return [String, Boolean] `"OK"` or true, false if `:nx => true` or `:xx => true`
  def set(key, value, options = {})

Steps:

Loading development environment (Rails 4.0.0)
irb(main):001:0> redis = Redis.new
=> #<Redis client v3.0.5 for redis://127.0.0.1:6379/0>
irb(main):002:0> redis.set "123", "123"
"[:set, \"123\", \"123\"]"
=> "OK"
irb(main):003:0> redis.set "123", "123", ex: 60
"[:set, \"123\", \"123\", \"EX\", 60]"
Redis::CommandError: ERR wrong number of arguments for 'set' command
@pietern
Copy link
Collaborator

pietern commented Oct 17, 2013

The extra options to SET have been supported since Redis 2.6.12. Likely you're running an older version of Redis.

@pietern pietern closed this as completed Oct 17, 2013
@jormon
Copy link

jormon commented Jan 2, 2014

Pietern, you can see in the quote above that the user is running redis 3.0.6, not "an older version". There is an issue with the parameter paramater passing of &_boolify_set on line 673 of redis-rb/lib/redis.rb

Looking into this now myself since I'm blocking on it...

@djanowski
Copy link
Collaborator

3.0.5 is the client version not Redis'.
On Jan 2, 2014 12:45 PM, "Jordan Moncharmont" notifications@github.com
wrote:

Pietern, you can see in the quote above that the user is running redis
3.0.6, not "an older version". There is an issue with the parameter
paramater passing of &_boolify_set on line 673 of redis-rb/lib/redis.rb

Looking into this now myself since I'm blocking on it...


Reply to this email directly or view it on GitHubhttps://github.com//issues/372#issuecomment-31460552
.

@jormon
Copy link

jormon commented Jan 2, 2014

True story! For anyone else who finds this thread, RedisToGo ships with 2.4.x by default :/

@djanowski
Copy link
Collaborator

@jormon You can try @soveran and @cyx's http://openredis.com

@Zhenbin24
Copy link

redis版本过低

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

5 participants