Commit d4d4cab12654c02591ec35c647d6b0a2e250c0a8
Committed by
Antonio Terceiro
1 parent
2fd72e94
Exists in
master
and in
29 other branches
ActionItem1205: fixing cache_timeout
* making profile index expire
Showing
5 changed files
with
13 additions
and
4 deletions
Show diff stats
app/helpers/sweeper_helper.rb
app/models/person.rb
app/sweepers/profile_sweeper.rb
... | ... | @@ -17,8 +17,11 @@ protected |
17 | 17 | profile.members.each do |member| |
18 | 18 | expire_communities(member) if profile.community? |
19 | 19 | expire_enterprises(member) if profile.enterprise? |
20 | + expire_profile_index(member) if profile.enterprise? | |
20 | 21 | end |
21 | 22 | |
23 | + expire_profile_index(profile) if profile.person? | |
24 | + | |
22 | 25 | profile.blocks.each do |block| |
23 | 26 | expire_timeout_fragment(block.cache_keys) |
24 | 27 | end | ... | ... |
app/views/profile/_person.rhtml
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | <%= display_field(_('e-Mail:'), profile, :email, true) { |email| link_to_email(email) } %> |
17 | 17 | <% end %> |
18 | 18 | |
19 | -<% cache_timeout(profile.identifier + '-profile-relationships', 4.hours.from_now) do %> | |
19 | +<% cache_timeout(profile.relationships_cache_key, 4.hours.from_now) do %> | |
20 | 20 | <% if !(profile.organization.blank? && profile.organization_website.blank?) && (profile.active_fields.include?('organization') || profile.active_fields.include?('organization_website')) %> |
21 | 21 | <tr> |
22 | 22 | <th colspan='2'><%= _('Work')%></th> | ... | ... |
vendor/plugins/timed_cached_fragment/lib/timed_cache_fragment.rb
... | ... | @@ -3,14 +3,13 @@ module ActionController |
3 | 3 | module Cache |
4 | 4 | module TimedCache |
5 | 5 | #handles standard ERB fragments used in RHTML |
6 | - def cache_timeout(name={}, expire = 10.minutes.from_now, &block) | |
6 | + def cache_timeout(key={}, expire = 10.minutes.from_now, &block) | |
7 | 7 | unless perform_caching then block.call; return end |
8 | - key = fragment_cache_key(name) | |
9 | 8 | if is_cache_expired?(key,true) |
10 | 9 | expire_timeout_fragment(key) |
11 | 10 | set_timeout(key, expire) |
12 | 11 | end |
13 | - cache_erb_fragment(block,name) | |
12 | + cache_erb_fragment(block,key) | |
14 | 13 | end |
15 | 14 | #handles the expiration of timeout fragment |
16 | 15 | def expire_timeout_fragment(key) | ... | ... |