You are fighting Rails, in my experience not a time effective thing to do. Why do you want use Rails and not do it the Rails way?
Jeffrey Quoting Prachi Tripathi <li...@ruby-forum.com>: > Hi Jeffrey, > > I kept the folowing configuration only: > config.cache_store = :mem_cache_store > and it works. > > But now i want to try other way that is creating an instance like this: > > 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 > > and i commented out the following: > config.cache_store = :mem_cache_store > > But during server startup it throws the following error: > > => Booting WEBrick > => Rails 2.3.5 application starting on http://0.0.0.0:3000 > C:/WEB2.0/Workspaces/RELEASE 2/Version > 1/microblogging/vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in > > ` > load_missing_constant': uninitialized constant MemCache (NameError) > from C:/WEB2.0/Workspaces/RELEASE 2/Version > 1/microblogging/vendor/rails/activesupport/lib/active_support/dependencie > s.rb:80:in `const_missing_with_dependencies' > from C:/WEB2.0/Workspaces/RELEASE 2/Version > 1/microblogging/vendor/rails/activesupport/lib/active_support/dependencie > s.rb:92:in `const_missing' > from C:/WEB2.0/Workspaces/RELEASE 2/Version > 1/microblogging/config/environment.rb:62 > from C:/WEB2.0/Workspaces/RELEASE 2/Version > 1/microblogging/config/environment.rb:31:in `require' > from > c:/jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in > `require' > from C:/WEB2.0/Workspaces/RELEASE 2/Version > 1/microblogging/vendor/rails/activesupport/lib/active_support/dependencie > s.rb:156:in `require' > from C:/WEB2.0/Workspaces/RELEASE 2/Version > 1/microblogging/vendor/rails/activesupport/lib/active_support/dependencie > s.rb:521:in `new_constants_in' > from C:/WEB2.0/Workspaces/RELEASE 2/Version > 1/microblogging/vendor/rails/activesupport/lib/active_support/dependencie > s.rb:156:in `require' > from C:/WEB2.0/Workspaces/RELEASE 2/Version > 1/microblogging/vendor/rails/railties/lib/commands/server.rb:84 > from C:/WEB2.0/Workspaces/RELEASE 2/Version > 1/microblogging/vendor/rails/railties/lib/commands/server.rb:31:in > `requi > re' > from > c:/jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in > `require' > from script/server:3 > > How do i create a constant which is an instance of memcache, as i am > trying above? > > > > > > > Jeffrey L. Taylor wrote: > > Quoting Yani Yen <li...@ruby-forum.com>: > >> > > >> > What i did in my environment.rb file was created an instance of memcache > >> > and assign it to a constant: > >> > > >> > CACHE = MemCache.new('127.0.0.1') > >> > > >> > and then in my code something like this: > > [snip] > > > > Okay, that makes it clearer to me. I think you are starting two > > instances of > > the cache client and the second one fails because the first is already > > present > > and running. Try with just the > > > > config.cache_store = :mem_cache_store > > > > and comment out the rest. > > > > Jeffrey > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.