aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/application_helper.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-03-04 09:53:26 +0000
committerLouise Crow <louise.crow@gmail.com>2014-03-04 09:53:26 +0000
commit3912c73583464e3ff203e3e101325ccabcba0506 (patch)
tree3b57620358c4c4cfe1c52702f2979876f6452aa0 /app/helpers/application_helper.rb
parent2a49615ee3ea08f7952283efc0306a1ac0c23334 (diff)
parentaf83354da1030c2d2fad3c63f3ccb516c4923d38 (diff)
Merge branch 'release/0.17' into wdtk
Conflicts: config/general.yml-example
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 4b603b064..154697377 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -123,5 +123,18 @@ module ApplicationHelper
yield
end
end
+
+ # We only want to cache request lists that have a reasonable chance of not expiring
+ # before they're requested again. Don't cache lists returned from specific searches
+ # or anything except the first page of results, just the first page of the default
+ # views
+ def request_list_cache_key
+ cacheable_param_list = ['controller', 'action', 'locale', 'view']
+ if params.keys.all?{ |key| cacheable_param_list.include?(key) }
+ "request-list-#{@view}-#{@locale}"
+ else
+ nil
+ end
+ end
end