Skip to content

Commit

Permalink
Use dalli_store for all environments
Browse files Browse the repository at this point in the history
Reduces possible inconsistency issues between 
dev, test, and prod.
  • Loading branch information
simple10 committed Oct 20, 2014
1 parent 4d19548 commit 38e54be
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -4,6 +4,7 @@ rvm:
services:
- postgresql
- redis-server
- memcached
env:
- RAILS_ENV=test
before_install:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -24,6 +24,7 @@ gem 'airbrake', '~> 3.2.1' # use with airbrake.io or errbit

# Data
gem 'pg'
gem 'dalli' # memcached
# gem 'schema_plus' # add better index and foreign key support
# gem 'jbuilder'

Expand Down Expand Up @@ -146,7 +147,6 @@ group :test do
end

group :production do
gem 'dalli' # memcached
gem 'memcachier' # heroku add-on for auto config of dalli
gem 'unicorn'
gem 'rails_12factor' # https://devcenter.heroku.com/articles/rails4
Expand Down
7 changes: 7 additions & 0 deletions config/application.rb
Expand Up @@ -20,6 +20,13 @@ class Application < Rails::Application
# Use sql instead of ruby to support case insensitive indices for postgres
config.active_record.schema_format = :sql

# Cache
# config.cache_store = :memory_store
# config.cache_store = :mem_cache_store, ENV['MEMCACHE_SERVERS].split(','),
# { namespace: Rails.application.config.settings.app_name, expires_in: 30.day, compress: true }
# Set cache_store the same for all environments to avoid inconsistency issues
config.cache_store = :dalli_store

# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
Expand Down
7 changes: 0 additions & 7 deletions config/environments/production.rb
Expand Up @@ -53,13 +53,6 @@
config.logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)

# Use a different cache store in production.
# If using Memcachier on Heroku, the memcachier gem will auto config servers
# config.cache_store = :memory_store
# config.cache_store = :mem_cache_store, ENV['MEMCACHE_SERVERS].split(','),
# { namespace: Rails.application.config.settings.app_name, expires_in: 30.day, compress: true }
config.cache_store = :dalli_store

#
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
Expand Down

0 comments on commit 38e54be

Please sign in to comment.