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 wou开发者_如何转开发ld 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.
Could it be a bug in the Ruby gem? ;-)
精彩评论