From 339dedd29167548f46e11fe75af0ce05de47c330 Mon Sep 17 00:00:00 2001 From: takahashim Date: Sat, 23 Nov 2024 16:12:51 +0900 Subject: [PATCH] Use expire_session_after for session, REDIS_CACHE_EXPIRES_IN for cache --- config/environments/development.rb | 7 +++++-- config/environments/production.rb | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index 765209d1a..084add8e0 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -20,8 +20,11 @@ config.action_controller.perform_caching = true if ENV["REDIS_CACHE_URL"] - config.cache_store = :redis_cache_store, { url: ENV.fetch("REDIS_CACHE_URL", nil) } - config.session_store(:cache_store, key: "decidim_session") + config.cache_store = :redis_cache_store, { + url: ENV.fetch("REDIS_CACHE_URL", nil), + expires_in: ENV.fetch("REDIS_CACHE_EXPIRES_IN", 60.minutes).to_i + } + config.session_store(:cache_store, key: "decidim_session", expire_after: Decidim.config.expire_session_after) else config.cache_store = :memory_store end diff --git a/config/environments/production.rb b/config/environments/production.rb index 64c4bb6ec..5ca1bf212 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -51,8 +51,11 @@ # Use a different cache store in production. # config.cache_store = :mem_cache_store - config.cache_store = :redis_cache_store, { url: ENV.fetch("REDIS_CACHE_URL", nil) } - config.session_store(:cache_store, key: "decidim_session") + config.cache_store = :redis_cache_store, { + url: ENV.fetch("REDIS_CACHE_URL", nil), + expires_in: ENV.fetch("REDIS_CACHE_EXPIRES_IN", 60.minutes).to_i + } + config.session_store(:cache_store, key: "decidim_session", expire_after: Decidim.config.expire_session_after) # Use a real queuing backend for Active Job (and separate queues per environment) # config.active_job.queue_adapter = :resque