/** * Remove cache data * * @param string $key config name * @return void */ protected function erase($key) { $segments = explode('.', $key); $head = reset($segments); if ($key == $head) { $this->cache->forget($this->getCacheKey($head)); } else { $cache = $this->make($this->getAll($head), $segments, null); $this->cache->put($this->getCacheKey($head), $cache); } foreach ($this->bag as $k => $item) { if (substr($k, 0, strlen($key)) == $key) { unset($this->bag[$k]); } } }
/** * Delete the route item from the repository * * @param InstanceRoute $route route instance * @return bool|null */ public function delete(InstanceRoute $route) { $this->cache->forget($this->getCacheKey($route->siteKey . '_' . $route->url)); $this->cache->forget($this->getCacheKey($route->instanceId)); return $this->repo->delete($route); }
/** * Delete menu item * * @param MenuItem $item menu item instance * @return bool */ public function deleteItem(MenuItem $item) { $this->cache->forget($this->getCacheKey($item->menu->getKey())); return $this->repo->deleteItem($item); }
/** * Remove an item from the cache. * * @param Permission $item permission instance * @return void */ protected function forget(Permission $item) { $this->cache->forget($this->getCacheKey($item->siteKey, $item->name)); $this->cache->forget($this->getCacheKey($item->siteKey, $item->name, 'ancestor')); $this->cache->forget($this->getCacheKey($item->siteKey, $item->name, 'descendant')); }
/** * Delete menu item * * @param MenuItem $item menu item instance * @return bool */ public function deleteItem(MenuItem $item) { $key = $this->getItemCacheKey($item->getKey()); $this->cache->forget($key); return $this->repo->deleteItem($item); }
/** * Remove cache data * * @param string $siteKey site key * @param string $name config name * @return void */ protected function erase($siteKey, $name) { $key = $this->makeKey($siteKey, $this->getHead($name)); unset($this->bag[$key]); $this->cache->forget($this->getCacheKey($key)); }