Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Memcached rubygem + Rlibmemcached argument error with memcache_mget()

I am getting an exception when using Evan Weaver's Memcached gem (as Memcached::Rails.new) -> (http://github.com/fauna/memcached) and calling get_multi()

ArgumentError: wrong # of arguments(2 for 4)
from /usr/local/lib/ruby/gems/1.8/gems/memcache-auth-1.0.1/lib/memcached/memcached.rb:384:in `memcached_mget'
from /usr/local/lib/ruby/gems/1.8/gems/memcache-auth-1.0.1/lib/memcached/memcached.rb:384:in `get_orig'
from /usr/local/lib/ruby/gems/1.8/gems/memcache-auth-1.0.1/lib/memcached/rails.rb:40:in `get_multi'

I noticed that memcached_get.h defines memcached_mget as:

memcached_return memcached_mget(memcached_st *ptr, 
                            const char * const *keys, 
                            const size_t *key_length, 
                            size_t number_of_keys);

So, it would seem key_length and number_of_keys are missing (my C is a bit rusty, but I'm presuming those would be required arguments).

However, it looks like the associated ruby code (in rails.rb) is only passing 2 args:

def get_multi(keys, raw=false)
  get_orig(keys, !raw)
end

UPDATE: Turns out it was a bug in the ruby gem, which has now been patched.

like image 407
Kyle Avatar asked Feb 03 '10 21:02

Kyle


1 Answers

Could it be a bug in the Ruby gem? ;-)

like image 155
Inga Johansson Avatar answered Sep 28 '22 17:09

Inga Johansson