myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2004] branches/event_logging: Caching.


From: noreply
Subject: [myexperiment-hackers] [2004] branches/event_logging: Caching.
Date: Thu, 27 Nov 2008 07:05:06 -0500 (EST)

Revision
2004
Author
alekses6
Date
2008-11-27 07:05:06 -0500 (Thu, 27 Nov 2008)

Log Message

Caching. Latest group announcements on home page now cached.

Modified Paths

Diff

Modified: branches/event_logging/app/models/group_announcement_sweeper.rb (2003 => 2004)


--- branches/event_logging/app/models/group_announcement_sweeper.rb	2008-11-27 11:45:22 UTC (rev 2003)
+++ branches/event_logging/app/models/group_announcement_sweeper.rb	2008-11-27 12:05:06 UTC (rev 2004)
@@ -13,14 +13,18 @@
   # - 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)
+  # - listing of latest public group announcements on the home page
   #
   # Content in
   # - listing of group announcements;
-  # - group announcements box on group's page
   # is user-specific: i.e. either public or private&public
   # group announcements are shown to the current user
   # (the filtering is performed by the controller and caching done on individual fragments only,
   #  which means that non-members will not see certain fragments)
+  #
+  # Not cached because of "created X minutes ago" and very little content:
+  # - group announcements box on group's page
+  
   def after_create(group_announcement)
     expire_group_announcement(group_announcement)
     expire_listing(group_announcement.network.id, 'Network')
@@ -43,8 +47,9 @@
   private
   
   def expire_group_announcement(group_announcement)
-    # specific expires for the group announcement itself
+    # specific expires for the group announcement itself (done for all "create"/"update"/"destroy" actions)
     expire_listing(group_announcement.id, 'GroupAnnouncement')
+    expire_home_cache_group_announcements
   end
 
 end

Modified: branches/event_logging/app/views/home/_group_announcements.rhtml (2003 => 2004)


--- branches/event_logging/app/views/home/_group_announcements.rhtml	2008-11-27 11:45:22 UTC (rev 2003)
+++ branches/event_logging/app/views/home/_group_announcements.rhtml	2008-11-27 12:05:06 UTC (rev 2004)
@@ -6,7 +6,7 @@
 		Public Group Announcements
 	</div>
 	<div class="content">
-		<% #cache(:controller => 'home_cache', :action ="" 'announcements') do -%>
+		<% cache(:controller => 'home_cache', :action ="" 'group_announcements') do -%>
 			<% unless (announcements = GroupAnnouncement.latest_public(DEFAULT_RSS_ENTRY_COUNT)).empty? %>
 				<ul class="announcements">
 					<% announcements.each do |a| %>
@@ -21,7 +21,7 @@
 			<% else %>
 				<p class="none_text">None</p>
 			<% end %>
-		<% #end %>
+		<% end -%>
 	</div>
 	<b class="xbottom"><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b><b class="xb1"></b></b>
 </div>
\ No newline at end of file

Modified: branches/event_logging/lib/caching_helper.rb (2003 => 2004)


--- branches/event_logging/lib/caching_helper.rb	2008-11-27 11:45:22 UTC (rev 2003)
+++ branches/event_logging/lib/caching_helper.rb	2008-11-27 12:05:06 UTC (rev 2004)
@@ -27,6 +27,10 @@
     expire_fragment(%r{home_cache/latest_groups/[0-9]+})
   end
   
+  def expire_home_cache_group_announcements
+    expire_fragment(:controller => 'home_cache', :action ="" 'group_announcements')
+  end
+  
   # Methods to expire caches for the sidebar
   
   def expire_sidebar_user_monitor(user_id)

reply via email to

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