aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/application_helper.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-01-28 16:33:02 +0000
committerLouise Crow <louise.crow@gmail.com>2014-01-28 16:33:02 +0000
commit89a8fd2ce9880ae0f194733991aa93e447f0ba73 (patch)
tree7fd691a4f7cbd3f1aff61dd91f056a16478d5291 /app/helpers/application_helper.rb
parent90fd29903b9db724c941b6e6efa39f41313e8825 (diff)
parentdf0583a94c6a3ce7ded818cb46688b7edc928302 (diff)
Merge branch 'feature/cache-request-lists' into rails-3-develop
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