Skip to content

Commit

Permalink
doing cache for menus
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Feb 8, 2010
1 parent 845c7cf commit 6113ef8
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions infinitas/management/models/menu_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ function getMenu($type = null){
return false;
}

$menus = Cache::read('menu_'.$type);
$menus = Cache::read('menu_'.$type, 'core');
if (!empty($menus)) {
//return $menus;
return $menus;
}

$menus = $this->find(
Expand Down Expand Up @@ -65,9 +65,33 @@ function getMenu($type = null){
)
);

Cache::write('menu_'.$type, $menus);
Cache::write('menu_'.$type, $menus, 'core');

return $menus;
}

function afterSave($created) {
parent::afterSave($created);

$menus = $this->find( 'list' );

foreach($menus as $menu){
Cache::delete('menu_'.$menu, 'core');
}

return true;
}

function afterDelete() {
parent::afterDelete();

$menus = $this->find( 'list' );

foreach($menus as $menu){
Cache::delete('menu_'.$menu, 'core');
}

return true;
}
}
?>

0 comments on commit 6113ef8

Please sign in to comment.