Skip to content

Commit

Permalink
DEVO-1848: Cache requests to save time.
Browse files Browse the repository at this point in the history
Caches queries and pages.

Also caches query_list requests.

Also caches primo requests.

Does not cache libguides.
  • Loading branch information
dkinzer committed Feb 22, 2024
1 parent 21eb6f2 commit 341a618
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Gemfile
Expand Up @@ -97,3 +97,7 @@ group :production do
gem "dalli"
gem "connection_pool"
end

gem "actionpack-page_caching", "~> 1.2"

gem "actionpack-action_caching", "~> 1.2"
6 changes: 6 additions & 0 deletions Gemfile.lock
Expand Up @@ -117,6 +117,10 @@ GEM
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionpack-action_caching (1.2.2)
actionpack (>= 4.0.0)
actionpack-page_caching (1.2.4)
actionpack (>= 4.0.0)
actiontext (6.1.7.6)
actionpack (= 6.1.7.6)
activerecord (= 6.1.7.6)
Expand Down Expand Up @@ -622,6 +626,8 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
actionpack-action_caching (~> 1.2)
actionpack-page_caching (~> 1.2)
alma!
autoprefixer-rails
awesome_print
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/catalog_controller.rb
@@ -1,6 +1,9 @@
# frozen_string_literal: true

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

include FacetParamsDedupe
include BlacklightAdvancedSearch::Controller
include BlacklightRangeLimit::ControllerOverride
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/query_list_controller.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true

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

def show
search_service = search_service_class.new(config: blacklight_config, user_params: params)

Expand Down

0 comments on commit 341a618

Please sign in to comment.