[116894] branches/gsoc11-statistics/stats-server/app/sweepers/ installed_port_sweeper.rb
cal at macports.org
cal at macports.org
Sun Feb 9 08:59:24 PST 2014
Revision: 116894
https://trac.macports.org/changeset/116894
Author: cal at macports.org
Date: 2014-02-09 08:59:24 -0800 (Sun, 09 Feb 2014)
Log Message:
-----------
macports stats: clear ports cache after a submission
Added Paths:
-----------
branches/gsoc11-statistics/stats-server/app/sweepers/installed_port_sweeper.rb
Copied: branches/gsoc11-statistics/stats-server/app/sweepers/installed_port_sweeper.rb (from rev 116815, branches/gsoc11-statistics/stats-server/app/sweepers/port_sweeper.rb)
===================================================================
--- branches/gsoc11-statistics/stats-server/app/sweepers/installed_port_sweeper.rb (rev 0)
+++ branches/gsoc11-statistics/stats-server/app/sweepers/installed_port_sweeper.rb 2014-02-09 16:59:24 UTC (rev 116894)
@@ -0,0 +1,21 @@
+class InstalledPortSweeper < ActionController::Caching::Sweeper
+ observe InstalledPort
+
+ def after_create(installedport)
+ expire_cache_for installedport.port
+ end
+
+ def after_update(installedport)
+ expire_cache_for installedport.port
+ end
+
+ def after_destroy(installedport)
+ expire_cache_for installedport.port
+ end
+
+ private
+ def expire_cache_for(port)
+ logger.debug "Expiring cache for #{port.category}/#{port.name}"
+ expire_page category_port_path(port.category, port)
+ end
+end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140209/19d36ec2/attachment.html>
More information about the macports-changes
mailing list