]> _ Git - cubist_cms-back.git/commitdiff
wip #3151
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 18 Oct 2019 10:36:08 +0000 (12:36 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 18 Oct 2019 10:36:08 +0000 (12:36 +0200)
src/app/Magic/Controllers/CubistMagicController.php
src/app/Magic/Menu/Menu.php

index d2596a26488326bf87448f91c93660996fad4f5e..110a75ebc14eaf133679fb2de6a89e52472580b9 100644 (file)
@@ -6,6 +6,7 @@ namespace Cubist\Backpack\app\Magic\Controllers;
 use Cubist\Backpack\app\Http\Controllers\CubistCrudController;
 use Backpack\CRUD\CrudTrait;
 use Cubist\Backpack\app\Magic\Fields\Field;
+use Cubist\Backpack\app\Magic\Menu\Menu;
 use Cubist\Backpack\app\Magic\Models\CubistMagicAbstractModel;
 use Cubist\Backpack\app\Magic\Requests\CubistMagicRequest;
 use Cubist\Backpack\app\Magic\Requests\CubistMagicStoreRequest;
@@ -221,7 +222,7 @@ class CubistMagicController extends CubistCrudController
 
     protected function _forgetCache()
     {
-        Cache::forget('navigation');
+        Cache::tags(Menu::CACHE_TAG)->flush();
     }
 
     public function index()
index 8f66af882d49486ff8bf7155ce72de4bd3fd88b0..74299da1da2cb692d3fceb3e74f0cc54e20ef2a0 100644 (file)
@@ -16,6 +16,7 @@ class Menu extends BaseMenu
     protected static $_nav = null;
 
     protected const _STANDARD_PREFIX = 'cubist';
+    public const CACHE_TAG = 'cubist_nav';
 
     protected $_registeredMenuMakers = [];
 
@@ -43,7 +44,7 @@ class Menu extends BaseMenu
     {
         if (self::$_nav === null) {
             \Barryvdh\Debugbar\Facade::startMeasure('nav', 'Init Navigation object');
-            self::$_nav = Cache::remember('navigation_' . App::getLocale(), 43200, function () {
+            self::$_nav = Cache::tags(self::CACHE_TAG)->remember('navigation_' . App::getLocale(), 43200, function () {
                 $nav = new Item();
                 $nav->initFromDatabase();
                 return $nav;