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:
Javi Martín
2022-09-28 13:28:31 +02:00
parent 52ebeb7ba6
commit e93b693f71
3 changed files with 3 additions and 3 deletions

View File

@@ -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}"
}