Rails example app for AWS Elastic Beanstalk
This is an example Rails application that demonstrates the use of
caching using MemCachier on AWS Elastic
Beanstalk. This example is written with Rails 5.2.
You can read the full tutorial
here.
Setting up MemCachier to work in Rails is very easy. You need to make
changes to Gemfile, production.rb, and any app code that you want
cached. These changes are covered in detail below.
MemCachier has been tested with the dalli memcache
client. Add the following gem to
your Gemfile:
gem 'dalli'
Ensure that the following configuration option is set in production.rb:
config.cache_store = :mem_cache_store,
(ENV["MEMCACHIER_SERVERS"] || "").split(","),
{:username => ENV["MEMCACHIER_USERNAME"],
:password => ENV["MEMCACHIER_PASSWORD"],
:failover => true,
:socket_timeout => 1.5,
:socket_failure_delay => 0.2,
:down_retry_delay => 60
}
In your application, use Rails.cache
methods to access MemCachier.
A list of methods is available
here.
All the built-in Rails caching tools will work, too.
We are happy to receive bug reports, fixes, documentation enhancements,
and other improvements.
Please report bugs via the
github issue tracker.
Master git repository:
git clone git://github.com/memcachier/examples-rails-contacts.git
This library is BSD-licensed.