Commit d070eece9c104fb7e06532380202a506aeb62029

Authored by Antonio Terceiro
1 parent b62b0d9c

Some points still need #is_cache_expired?(key)

app/controllers/public/profile_controller.rb
... ... @@ -23,7 +23,7 @@ class ProfileController < PublicController
23 23  
24 24 def tags
25 25 @tags_cache_key = "tags_profile_#{profile.id.to_s}"
26   - if is_cache_expired?(@tags_cache_key, true)
  26 + if is_cache_expired?(@tags_cache_key)
27 27 @tags = profile.article_tags
28 28 end
29 29 end
... ... @@ -31,7 +31,7 @@ class ProfileController < PublicController
31 31 def content_tagged
32 32 @tag = params[:id]
33 33 @tag_cache_key = "tag_#{CGI.escape(@tag.to_s)}_#{profile.id.to_s}_page_#{params[:npage]}"
34   - if is_cache_expired?(@tag_cache_key, true)
  34 + if is_cache_expired?(@tag_cache_key)
35 35 @tagged = profile.find_tagged_with(@tag).paginate(:per_page => 20, :page => params[:npage])
36 36 end
37 37 end
... ...
app/helpers/application_helper.rb
... ... @@ -1316,4 +1316,9 @@ module ApplicationHelper
1316 1316 def cache_timeout(key, timeout, &block)
1317 1317 cache(key, { :expires_in => timeout }, &block)
1318 1318 end
  1319 +
  1320 + def is_cache_expired?(key)
  1321 + !cache_store.fetch(ActiveSupport::Cache.expand_cache_key(key, :controller))
  1322 + end
  1323 +
1319 1324 end
... ...