Author: sevein
Date: Tue Jun 14 11:03:05 2011
New Revision: 9161

Log:
Cache browseMenu and mainMenu components, clean cache when menu module is used

Added:
   trunk/apps/qubit/modules/menu/config/cache.yml
Modified:
   trunk/apps/qubit/modules/menu/actions/deleteAction.class.php
   trunk/apps/qubit/modules/menu/actions/editAction.class.php
   trunk/apps/qubit/modules/menu/actions/listAction.class.php
   trunk/apps/qubit/templates/_header.php
   trunk/apps/qubit/templates/layout.php

Modified: trunk/apps/qubit/modules/menu/actions/deleteAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/menu/actions/deleteAction.class.php        Tue Jun 
14 11:01:30 2011        (r9160)
+++ trunk/apps/qubit/modules/menu/actions/deleteAction.class.php        Tue Jun 
14 11:03:05 2011        (r9161)
@@ -37,6 +37,10 @@
         $this->menu->delete();
       }
 
+      // Remove cache
+      
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=settings');
+      
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=settings');
+
       $this->redirect(array('module' => 'menu', 'action' => 'list'));
     }
   }

Modified: trunk/apps/qubit/modules/menu/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/menu/actions/editAction.class.php  Tue Jun 14 
11:01:30 2011        (r9160)
+++ trunk/apps/qubit/modules/menu/actions/editAction.class.php  Tue Jun 14 
11:03:05 2011        (r9161)
@@ -152,6 +152,10 @@
 
         $this->menu->save();
 
+        // Remove cache
+        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=settings');
+        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=settings');
+
         $this->redirect(array('module' => 'menu', 'action' => 'list'));
       }
     }

Modified: trunk/apps/qubit/modules/menu/actions/listAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/menu/actions/listAction.class.php  Tue Jun 14 
11:01:30 2011        (r9160)
+++ trunk/apps/qubit/modules/menu/actions/listAction.class.php  Tue Jun 14 
11:03:05 2011        (r9161)
@@ -40,6 +40,10 @@
       {
         $menu->moveAfterById($request->after);
       }
+
+      // Remove cache
+      
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=settings');
+      
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=settings');
     }
 
     // Get an array with menu ids and depth (relative to top menu) to create

Added: trunk/apps/qubit/modules/menu/config/cache.yml
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/apps/qubit/modules/menu/config/cache.yml      Tue Jun 14 11:03:05 
2011        (r9161)
@@ -0,0 +1,5 @@
+_browseMenu:
+  enabled: on
+
+_mainMenu:
+  enabled: on

Modified: trunk/apps/qubit/templates/_header.php
==============================================================================
--- trunk/apps/qubit/templates/_header.php      Tue Jun 14 11:01:30 2011        
(r9160)
+++ trunk/apps/qubit/templates/_header.php      Tue Jun 14 11:03:05 2011        
(r9161)
@@ -35,4 +35,4 @@
 
 <?php echo get_component('search', 'box') ?>
 
-<?php echo get_component('menu', 'browseMenu') ?>
+<?php echo get_component('menu', 'browseMenu', array('sf_cache_key' => 
'settings')) ?>

Modified: trunk/apps/qubit/templates/layout.php
==============================================================================
--- trunk/apps/qubit/templates/layout.php       Tue Jun 14 11:01:30 2011        
(r9160)
+++ trunk/apps/qubit/templates/layout.php       Tue Jun 14 11:03:05 2011        
(r9161)
@@ -20,7 +20,7 @@
         <?php if ($sf_user->isAuthenticated()): ?>
           <div id="navigation">
             <div class="section">
-              <?php echo get_component('menu', 'mainMenu') ?>
+              <?php echo get_component('menu', 'mainMenu', 
array('sf_cache_key' => 'settings')) ?>
             </div> <!-- /.section -->
           </div> <!-- /#navigation -->
         <?php endif; ?>

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to