我在使用Evan Weaver的Memcached gem(如Memcached :: Rails.new) - >(http://github.com/fauna/memcached)并调用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'
我注意到memcached_get.h将memcached_mget定义为:
memcached_return memcached_mget(memcached_st *ptr, const char * const *keys, const size_t *key_length, size_t number_of_keys);
所以,似乎缺少key_length和number_of_keys(我的C有点生疏,但我认为那些将是必需的参数).
但是,看起来相关的ruby代码(在rails.rb中)只传递2个args:
def get_multi(keys, raw=false) get_orig(keys, !raw) end
更新:事实证明这是红宝石宝石中的一个错误,现在已经修补了.