problem while connecting to memcache servers over network

Eric Hodel drbrain at segment7.net
Wed Jul 18 18:43:57 UTC 2007


On Jul 18, 2007, at 07:38, hemant wrote:
> I am using ruby memcache client,
> http://seattlerb.rubyforge.org/memcache-client/ for connecting to
> memcache servers.
>
> I am attempting to connect to a memcache server located in another
> machine, through internet( so no its not also in same domain and all).
> Although I can open telnet prompt from the same machine at port 11211,
> but memcache throws error when attempting to make a connection to the
> same machine at same port:
>
> /usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/lib/ 
> memcache.rb:539:in
> `request_setup': No connection to server (MemCache::MemCacheError)
>        from /usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/ 
> lib/memcache.rb:199:in
> `[]'
>        from a.rb:23
>
>
> My code is:
>
> require "rubygems"
> require "memcache"
>
> memcache_options = {
>  :c_threshold => 10_000,
>  :compression => true,
>  :debug => false,
>  :namespace => 'bekar_data',
>  :readonly => false,
>  :urlencode => false
> }

The client you're using only supports two of those  
options, :namespace and :readonly

cache = MemCache.new :namespace => 'bekar_data'
cache.servers = '...'

begin
   cache['my_key'] = '3232'
rescue MemCache::MemCacheError => e
   puts e.message
   p cache
   # Huh, I thought I had an accessor for this
   p cache.instance_variable_get(:@servers)
end

--
Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars




More information about the memcached mailing list