diff --git a/app/helpers/sweeper_helper.rb b/app/helpers/sweeper_helper.rb index 6b4bd9e..83c3e5d 100644 --- a/app/helpers/sweeper_helper.rb +++ b/app/helpers/sweeper_helper.rb @@ -43,4 +43,7 @@ module SweeperHelper blocks.map(&:cache_keys).each{|ck|expire_timeout_fragment(ck)} end + def expire_profile_index(profile) + expire_timeout_fragment(profile.relationships_cache_key) + end end diff --git a/app/models/person.rb b/app/models/person.rb index c06bf74..aa301e8 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -275,4 +275,8 @@ class Person < Profile page = params[:npage] || '1' identifier + '-manage-friends-page-' + page end + + def relationships_cache_key + identifier + '-profile-relationships' + end end diff --git a/app/sweepers/profile_sweeper.rb b/app/sweepers/profile_sweeper.rb index d7b7f33..0a355e3 100644 --- a/app/sweepers/profile_sweeper.rb +++ b/app/sweepers/profile_sweeper.rb @@ -17,8 +17,11 @@ protected profile.members.each do |member| expire_communities(member) if profile.community? expire_enterprises(member) if profile.enterprise? + expire_profile_index(member) if profile.enterprise? end + expire_profile_index(profile) if profile.person? + profile.blocks.each do |block| expire_timeout_fragment(block.cache_keys) end diff --git a/app/views/profile/_person.rhtml b/app/views/profile/_person.rhtml index ae9fd17..202300a 100644 --- a/app/views/profile/_person.rhtml +++ b/app/views/profile/_person.rhtml @@ -16,7 +16,7 @@ <%= display_field(_('e-Mail:'), profile, :email, true) { |email| link_to_email(email) } %> <% end %> -<% cache_timeout(profile.identifier + '-profile-relationships', 4.hours.from_now) do %> +<% cache_timeout(profile.relationships_cache_key, 4.hours.from_now) do %> <% if !(profile.organization.blank? && profile.organization_website.blank?) && (profile.active_fields.include?('organization') || profile.active_fields.include?('organization_website')) %> <%= _('Work')%> diff --git a/vendor/plugins/timed_cached_fragment/lib/timed_cache_fragment.rb b/vendor/plugins/timed_cached_fragment/lib/timed_cache_fragment.rb index 2ce6430..9bb32d0 100644 --- a/vendor/plugins/timed_cached_fragment/lib/timed_cache_fragment.rb +++ b/vendor/plugins/timed_cached_fragment/lib/timed_cache_fragment.rb @@ -3,14 +3,13 @@ module ActionController module Cache module TimedCache #handles standard ERB fragments used in RHTML - def cache_timeout(name={}, expire = 10.minutes.from_now, &block) + def cache_timeout(key={}, expire = 10.minutes.from_now, &block) unless perform_caching then block.call; return end - key = fragment_cache_key(name) if is_cache_expired?(key,true) expire_timeout_fragment(key) set_timeout(key, expire) end - cache_erb_fragment(block,name) + cache_erb_fragment(block,key) end #handles the expiration of timeout fragment def expire_timeout_fragment(key) -- libgit2 0.21.2