3

Why does this code

redis.set("test", true, ex: 24.hours)

return the following exception?

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

I use these gems

  • redis (3.2.0)
  • redis-rails (4.0.0)
Kirby
  • 15,127
  • 10
  • 89
  • 104
user1531875
  • 49
  • 2
  • 8

2 Answers2

4

It could be a problem with the redis version, check this for more information: https://github.com/redis/redis-rb/issues/372

gernberg
  • 2,587
  • 17
  • 21
  • Thanks for pointing to this. More specifically, Redis versions before 2.6.12 don't support passing additional arguments to SET and similar commands. – Topher Hunt May 08 '15 at 19:46
3

The above answer is correct. You need to update Redis. If you're on mac, follow these steps to quickly update Redis:

  1. go to http://redis.io/download and download the latest version
  2. unpack it and go to that folder in the console
  3. $ make
  4. $ make install

And if you have an older version of Redis running at the moment, kill it:

  1. $ ps -ef | grep redis, the PID is the 2nd number on the 1st row
  2. sudo kill <the PID>

That's it

Kirby
  • 15,127
  • 10
  • 89
  • 104
Yossi Shasho
  • 3,632
  • 31
  • 47