Re: Memcache

Yani Yen
Mon, 19 Jul 2010 14:08:45 -0000

After reading through a lot of blogs, everyone seems to say that
memcache-client seems to be faster and better.

I installed memcache-client-1.8.5.gem

And my configuration in environment.rb file is:

memcache_options = {
   :compression => true,
   :debug => false,
   :namespace => "mem-#{RAILS_ENV}",
   :readonly => false,
   :urlencode => false
}

memcache_servers = [ ''127.0.0.1:11211'' ]

CACHE = MemCache.new(memcache_options)
CACHE.servers = memcache_servers

However, evrytime i do a get to memcache in the memcache console i see
it being retrieved, however i get error while displaying it.

The logs show :
MemCache::MemCacheError (Resource temporarily unavailable - ):
  c:/jruby-1.5.1/lib/ruby/1.8/net/protocol.rb:116:in `readuntil''
  app/controllers/application_controller.rb:102:in `data_cache''
  app/controllers/channel_members_controller.rb:27:in `follows''
  c:/jruby-1.5.1/lib/ruby/1.8/webrick/httpserver.rb:104:in `service''
  c:/jruby-1.5.1/lib/ruby/1.8/webrick/httpserver.rb:65:in `run''
  c:/jruby-1.5.1/lib/ruby/1.8/webrick/server.rb:173:in `start_thread''
  c:/jruby-1.5.1/lib/ruby/1.8/webrick/server.rb:162:in `start''
  c:/jruby-1.5.1/lib/ruby/1.8/webrick/server.rb:162:in `start_thread''
  c:/jruby-1.5.1/lib/ruby/1.8/webrick/server.rb:95:in `start''
  c:/jruby-1.5.1/lib/ruby/1.8/webrick/server.rb:92:in `each''
  c:/jruby-1.5.1/lib/ruby/1.8/webrick/server.rb:92:in `start''
  c:/jruby-1.5.1/lib/ruby/1.8/webrick/server.rb:23:in `start''
  c:/jruby-1.5.1/lib/ruby/1.8/webrick/server.rb:82:in `start''


Can anyone help what is happening?

Yani Yen wrote:
> Hi,
>
> I am analysis memcache. Hence would like to know whats the best client
> for memcache. Have read a lot about memcache-client gem. Is that the
> most popular and widely used one?
>
> Also most of my queries are complex queries and i have used find_by_sql
> for the same. Can i cache these results got from find_by_sql?
>
> Thanks in advance.