Use different cache namespaces for different tenants
Since records in different tenants can have the same ID, they can share the same `cache_key`, and so we need a namespace to differentiate them. Without them, records from one tenant could expire the cache of a record from another tenant.
This commit is contained in:
@@ -18,7 +18,7 @@ Rails.application.configure do
|
||||
config.action_controller.perform_caching = true
|
||||
config.action_controller.enable_fragment_cache_logging = true
|
||||
|
||||
config.cache_store = :memory_store
|
||||
config.cache_store = :memory_store, { namespace: proc { Tenant.current_schema }}
|
||||
config.public_file_server.headers = {
|
||||
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ Rails.application.configure do
|
||||
config.log_tags = [:request_id]
|
||||
|
||||
# Use a different cache store in production.
|
||||
config.cache_store = :mem_cache_store
|
||||
config.cache_store = :mem_cache_store, { namespace: proc { Tenant.current_schema }}
|
||||
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment).
|
||||
# config.active_job.queue_adapter = :resque
|
||||
|
||||
@@ -58,7 +58,7 @@ Rails.application.configure do
|
||||
config.log_tags = [:request_id]
|
||||
|
||||
# Use a different cache store in production.
|
||||
config.cache_store = :mem_cache_store
|
||||
config.cache_store = :mem_cache_store, { namespace: proc { Tenant.current_schema }}
|
||||
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment).
|
||||
# config.active_job.queue_adapter = :resque
|
||||
|
||||
Reference in New Issue
Block a user