Skip to content

Commit

Permalink
fix: Use expire_session_after for session, REDIS_CACHE_EXPIRES_IN for…
Browse files Browse the repository at this point in the history
… cache
  • Loading branch information
takahashim committed Nov 23, 2024
1 parent ef15aec commit 7f5eb63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7f5eb63

Please sign in to comment.