MemCached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up dynamic web applications by alleviating database load.
Setting up memcached in ruby on rails application is pretty easy using dalli gem. Once you install the gem. Configure few settings ie.
In gemfile:
gem 'dalli' |
In config/environments/production.rb:
config.cache_store = :dalli_store |
Installing memcached
brew install memcached #Mac OSX apt-get install memcached #ubuntu |
If You want to make any change, here is the configuration file:
vi /etc/memcached.conf |
To Check version of memcached installed:
memcached -h | head -l |
Starting and stoping memchached
In MacOSX:
/usr/local/bin/memcached/ |
On Ubuntu:
sudo /etc/init.d/memcached restart |
You can optionally install the ‘kgio’ gem to give Dalli a 20-30% performance boost. Now all the action caching and page caching will be memcached ;)
The post Quick way to setup memcached in Ruby on Rails application appeared first on Code Beer Startups.