Skip to content

Commit

Permalink
redis cache: separating the different production stages.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiedl committed Sep 26, 2014
1 parent 87d4288 commit b4150a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
::SECRETS = {}
end

# Determine a possible staging environment.
#
if __FILE__.start_with?('/var/')
::STAGE = __FILE__.split('/')[2] # ['wingolfsplattform', 'wingolfsplattform-master', 'wingolfsplattform-sandbox']
else
::STAGE = Rails.env.to_s
end

module Wingolfsplattform
class Application < Rails::Application

Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Caching
config.action_controller.perform_caching = true
# config.cache_store = :file_store, Rails.root.join("tmp/app_cache")
config.cache_store = :redis_store, 'redis://localhost:6379/0/cache_production_stage', { expires_in: 1.week }
config.cache_store = :redis_store, "redis://localhost:6379/0/cache_#{::STAGE}", { expires_in: 1.week }

# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
Expand Down

0 comments on commit b4150a4

Please sign in to comment.