我无法使用Dalli(一个 memcached 客户端)gem连接到Kestrel 。dalli 与红隼不兼容吗?
require 'dalli'
dc = Dalli::Client.new('localhost:221133')
dc.set('abc', 123)
从 IRB/Pry 执行此操作返回:
I, [2012-10-12T17:38:03.994201 #19524] INFO -- : localhost:22133 failed (count: 2)
Dalli::RingError: No server available
from /Users/eli/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/dalli-2.2.1/lib/dalli/ring.rb:45:in `server_for_key'
然而,使用 memcached gem 做同样的事情效果很好:
require 'memcached'
mc = Dalli::Client.new('localhost:221133')
mc.set('abc', 123)
mc.get('abc')
请注意,我尝试从 memcached gem 切换到 dalli 的唯一原因是我无法让 Heroku 安装 memcached gem:
rlibmemcached_wrap.c: In function ‘Init_rlibmemcached’:
rlibmemcached_wrap.c:13776: error: implicit declaration of function ‘sasl_client_init’
rlibmemcached_wrap.c:13776: error: ‘SASL_OK’ undeclared (first use in this function)
make: *** [rlibmemcached_wrap.o] Error 1