diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index af3a302..73d57ae 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -23,7 +23,7 @@ class ProfileController < PublicController def tags @tags_cache_key = "tags_profile_#{profile.id.to_s}" - if is_cache_expired?(@tags_cache_key, true) + if is_cache_expired?(@tags_cache_key) @tags = profile.article_tags end end @@ -31,7 +31,7 @@ class ProfileController < PublicController def content_tagged @tag = params[:id] @tag_cache_key = "tag_#{CGI.escape(@tag.to_s)}_#{profile.id.to_s}_page_#{params[:npage]}" - if is_cache_expired?(@tag_cache_key, true) + if is_cache_expired?(@tag_cache_key) @tagged = profile.find_tagged_with(@tag).paginate(:per_page => 20, :page => params[:npage]) end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 06e600b..8bbb444 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1316,4 +1316,9 @@ module ApplicationHelper def cache_timeout(key, timeout, &block) cache(key, { :expires_in => timeout }, &block) end + + def is_cache_expired?(key) + !cache_store.fetch(ActiveSupport::Cache.expand_cache_key(key, :controller)) + end + end -- libgit2 0.21.2