diff options
-rw-r--r-- | app/controllers/request_controller.rb | 7 | ||||
-rw-r--r-- | app/views/request/_sidebar.html.erb | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 341ecdcd5..841950cd5 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -92,6 +92,8 @@ class RequestController < ApplicationController # Sidebar stuff @sidebar = true + @similar_cache_key = cache_key_for_similar_requests(@info_request, @locale) + # Track corresponding to this page @track_thing = TrackThing.create_track_for_request(@info_request) @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ] @@ -962,5 +964,10 @@ class RequestController < ApplicationController file_info end + def cache_key_for_similar_requests(info_request, locale) + "request/similar/#{info_request.id}/#{locale}" + end + + end diff --git a/app/views/request/_sidebar.html.erb b/app/views/request/_sidebar.html.erb index 2659a7989..71405ae06 100644 --- a/app/views/request/_sidebar.html.erb +++ b/app/views/request/_sidebar.html.erb @@ -51,7 +51,7 @@ <%= render :partial => 'request/next_actions' %> - <% # TODO: Cache for 1 day %> + <% cache(@similar_cache_key, :expires_in => 1.day) do %> <% xapian_similar, xapian_similar_more = @info_request.similar_requests %> <% if !xapian_similar.nil? && xapian_similar.results.size > 0 %> <h2><%= _('Similar requests')%></h2> @@ -62,6 +62,7 @@ <p><%= link_to _("More similar requests"), similar_request_path(@info_request.url_title) %></p> <% end %> <% end %> + <% end %> <p><%= link_to _('Event history details'), request_details_path(@info_request) %></p> |