Skip to content

Commit

Permalink
Merge pull request #643 from codeforjapan/redis-cache-expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
ayuki-joto authored Nov 23, 2024
2 parents b385aa2 + 7f5eb63 commit e2f6d93
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 e2f6d93

Please sign in to comment.