Maintenance: Disable Rails default caching behavior because in memory cache leads to diverging cache state in multiple processes and no-cache is usually not a desired behavior.
This commit is contained in:
parent
67d3f35b05
commit
d2912ff25f
1 changed files with 13 additions and 12 deletions
|
@ -12,20 +12,21 @@ Rails.application.configure do
|
|||
# Show full error reports.
|
||||
config.consider_all_requests_local = true
|
||||
|
||||
# Commented out to ensure using file cache store as described in config/application.rb
|
||||
# Enable/disable caching. By default caching is disabled.
|
||||
# Run rails dev:cache to toggle caching.
|
||||
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
config.cache_store = :memory_store
|
||||
config.public_file_server.headers = {
|
||||
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
||||
}
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
config.cache_store = :null_store
|
||||
end
|
||||
# if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
||||
# config.action_controller.perform_caching = true
|
||||
#
|
||||
# config.cache_store = :memory_store
|
||||
# config.public_file_server.headers = {
|
||||
# 'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
||||
# }
|
||||
# else
|
||||
# config.action_controller.perform_caching = false
|
||||
#
|
||||
# config.cache_store = :null_store
|
||||
# end
|
||||
|
||||
# Store uploaded files on the local file system (see config/storage.yml for options)
|
||||
# config.active_storage.service = :local
|
||||
|
|
Loading…
Reference in a new issue