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')) %>