views:

324

answers:

1

Hi all - i'm trying to get memcached and the Interlock plugin working with a new rails app. The weird thing is that they both work fine in another app on the same machine and i can't figure out the difference that's stopping this app. The new app is rails 2.3.4 and the old one is 2.2.2 in case that's a factor.

When the app starts, i get a warning from interlock:

`install_memcached':Interlock::ConfigurationError: 'memcache-client' client requested but not installed. Try 'sudo gem install memcache-client'.

Now, i have memcache-client installed:

$> gem list | grep memcache
memcache-client (1.7.8)

The gem is in /var/lib/gems/1.8, which is in my GEM_PATH variable.

On a bit of further investigation, the above error is raised by interlock when it refers to the MemCache class, which doesn't exist and so raises an 'anonymous module' error. So, ultimately, the problem is that MemCache isn't loaded. I have a memcached.yml in my config folder (below) however. I'm stuck - any advice anyone?

#contents of config/memcached.yml
defaults:
  namespace: millionaire
  #sessions: true
  sessions: false
  client: memcache-client
  with_finders: true
development:
  servers:
    - 127.0.0.1:11211
production:
  servers:
    - 127.0.0.1:11211

EDIT - solved

The issue was how i was specifying the gem to use: i had to put this in my config/environment.rb file:

config.gem "memcache-client", :version => '1.5.0', :lib => "memcache"

This seems to be necessary when i use gems where the lib folder isn't called lib or the main file in the lib folder doesn't have the same name as the gem: i have to specify the lib/file name with the :lib option.

Kind of confused about this still but at least it works.

A: 

In the documentation of memcache-client ( http://github.com/mperham/memcache-client ), you can see :

Rails 2.1+ includes memcache-client 1.5.0 out of the box. See ActiveSupport::Cache::MemCacheStore and the Rails.cache method for more details. Rails 2.3+ will use the latest memcache-client gem installed.

Maybe it's a incompatibility between Memcache 1.5.0 and 1.7.8. You can try to uninstall memcache-client gem 1.7.8 and install memcache-client 1.5.0

gem uninstall memcache-client -v=1.7.8

gem install memcache-client -v=1.5.0

You can see it's now works.

shingara
Thanks Shingara. I've now uninstalled all the versions of memcache-client i had and installed 1.5.0. Interlock is still bitching when i start up, with the same error, ie that the MemCache class isn't defined. Do i need to do anything in rails to use memcache-client, besides have a memcached.yml file? I'm not requiring it for example. thanks, max
Max Williams
You use the last Interlock plugin ?
shingara
It's the one from http://blog.evanweaver.com/files/doc/fauna/interlock/files/README.htmlI got it working now btw - see main post with new edit.
Max Williams