Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cached actions. #4265

Merged
merged 1 commit into from Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/controllers/catalog_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class CatalogController < ApplicationController
caches_page :show, expires_in: 24.hours
caches_page :show
caches_action :index, expires_in: 12.hours, cache_path: Proc.new { |c| c.request.url }

include FacetParamsDedupe
Expand All @@ -13,6 +13,7 @@ class CatalogController < ApplicationController
include ServerErrors
include LCClassifications

skip_forgery_protection only: [:index]
before_action :authenticate_purchase_order!, only: [ :purchase_order, :purchase_order_action ]
before_action :set_thread_request
before_action only: :index do
Expand Down
4 changes: 4 additions & 0 deletions config/environments/development.rb
Expand Up @@ -18,6 +18,8 @@

# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
config.cache_store = :mem_cache_store, nil, { pool_size: 10, pool_timeout: 5 }

if Rails.root.join("tmp", "caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
Expand Down Expand Up @@ -89,4 +91,6 @@

# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true

config.action_controller.page_cache_directory = Rails.root.join("tmp", "cached_pages")
end
1 change: 1 addition & 0 deletions config/environments/production.rb
Expand Up @@ -136,4 +136,5 @@
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
Deprecation.default_deprecation_behavior = :silence
config.action_controller.page_cache_directory = Rails.root.join("public", "cached_pages")
end