myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2002] branches/event_logging/app: Caching.


From: noreply
Subject: [myexperiment-hackers] [2002] branches/event_logging/app: Caching.
Date: Thu, 27 Nov 2008 06:08:59 -0500 (EST)

Revision
2002
Author
alekses6
Date
2008-11-27 06:08:56 -0500 (Thu, 27 Nov 2008)

Log Message

Caching. Bug-fix. Listing of latest groups on the home page was displaying stale information, because caches were not invalidated properly on adding/deleting a group announcement.

Modified Paths

Diff

Modified: branches/event_logging/app/models/group_announcement_sweeper.rb (2001 => 2002)


--- branches/event_logging/app/models/group_announcement_sweeper.rb	2008-11-21 19:07:20 UTC (rev 2001)
+++ branches/event_logging/app/models/group_announcement_sweeper.rb	2008-11-27 11:08:56 UTC (rev 2002)
@@ -10,7 +10,9 @@
 
   # for "create","destroy" and "update" need to expire all places, where
   # cached content for group announcements is located:
-  # - listing of groups, as it contains the number of group announcements in it and the link/title of the last announcement
+  # - listing of groups, as it contains the number of group announcements in it (only at "create" / "destroy" of group announcements)
+  #   (the link/title of the last announcement is not cached at the moment, because it's user-specific: for members/non-members)
+  # - listing of groups on the home page (same as above)
   #
   # However content in
   # - listing of group announcements;
@@ -19,11 +21,15 @@
   # group announcements are shown to the current user
   def after_create(group_announcement)
     expire_group_announcement(group_announcement)
+    expire_listing(group_announcement.network.id, 'Network')
+    expire_home_cache_latest_groups
   end
 
 
   def after_destroy(group_announcement)
     expire_group_announcement(group_announcement)
+    expire_listing(group_announcement.network.id, 'Network')
+    expire_home_cache_latest_groups
   end
  
  
@@ -35,7 +41,8 @@
   private
   
   def expire_group_announcement(group_announcement)
-    expire_listing(group_announcement.network.id, 'Network')
+    # any specific expires for the group announcement itself
+    # (none for now)
   end
 
 end

Modified: branches/event_logging/app/views/networks/_table.rhtml (2001 => 2002)


--- branches/event_logging/app/views/networks/_table.rhtml	2008-11-21 19:07:20 UTC (rev 2001)
+++ branches/event_logging/app/views/networks/_table.rhtml	2008-11-27 11:08:56 UTC (rev 2002)
@@ -55,6 +55,7 @@
 							<p style="font-size: 85%;"><i>This Group has not been tagged yet!</i></p>
 					  <% end -%>
 				<% end -%>
+						<% # not cached, because different for members / non-members of the group -%>
 						<% latest_announcement = network.announcements_for_user(current_user).first -%>
 						<% unless latest_announcement.nil? -%>
 						  <p style="font-size: 85%; margin-top: 0.7em;">

reply via email to

[Prev in Thread] Current Thread [Next in Thread]