当前位置: 首页>>代码示例>>PHP>>正文


PHP CacheBackendInterface::invalidateAll方法代码示例

本文整理汇总了PHP中Drupal\Core\Cache\CacheBackendInterface::invalidateAll方法的典型用法代码示例。如果您正苦于以下问题:PHP CacheBackendInterface::invalidateAll方法的具体用法?PHP CacheBackendInterface::invalidateAll怎么用?PHP CacheBackendInterface::invalidateAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Cache\CacheBackendInterface的用法示例。


在下文中一共展示了CacheBackendInterface::invalidateAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rebuild

 /**
  * {@inheritdoc}
  */
 public function rebuild(array $definitions)
 {
     $links = array();
     $children = array();
     $top_links = array();
     // Fetch the list of existing menus, in case some are not longer populated
     // after the rebuild.
     $before_menus = $this->getMenuNames();
     if ($definitions) {
         foreach ($definitions as $id => $link) {
             // Flag this link as discovered, i.e. saved via rebuild().
             $link['discovered'] = 1;
             // Note: The parent we set here might be just stored in the {menu_tree}
             // table, so it will not end up in $top_links. Therefore the later loop
             // on the orphan links, will handle those cases.
             if (!empty($link['parent'])) {
                 $children[$link['parent']][$id] = $id;
             } else {
                 // A top level link - we need them to root our tree.
                 $top_links[$id] = $id;
                 $link['parent'] = '';
             }
             $links[$id] = $link;
         }
     }
     foreach ($top_links as $id) {
         $this->saveRecursive($id, $children, $links);
     }
     // Handle any children we didn't find starting from top-level links.
     foreach ($children as $orphan_links) {
         foreach ($orphan_links as $id) {
             // Check for a parent that is not loaded above since only internal links
             // are loaded above.
             $parent = $this->loadFull($links[$id]['parent']);
             // If there is a parent add it to the links to be used in
             // ::saveRecursive().
             if ($parent) {
                 $links[$links[$id]['parent']] = $parent;
             } else {
                 // Force it to the top level.
                 $links[$id]['parent'] = '';
             }
             $this->saveRecursive($id, $children, $links);
         }
     }
     $result = $this->findNoLongerExistingLinks($definitions);
     // Remove all such items.
     if ($result) {
         $this->purgeMultiple($result);
     }
     $this->resetDefinitions();
     $affected_menus = $this->getMenuNames() + $before_menus;
     // Invalidate any cache tagged with any menu name.
     $cache_tags = Cache::buildTags('config:system.menu', $affected_menus, '.');
     $this->cacheTagsInvalidator->invalidateTags($cache_tags);
     $this->resetDefinitions();
     // Every item in the cache bin should have one of the menu cache tags but it
     // is not guaranteed, so invalidate everything in the bin.
     $this->menuCacheBackend->invalidateAll();
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:63,代码来源:MenuTreeStorage.php

示例2: rebuild

 /**
  * {@inheritdoc}
  */
 public function rebuild(array $definitions)
 {
     $links = array();
     $children = array();
     $top_links = array();
     // Fetch the list of existing menus, in case some are not longer populated
     // after the rebuild.
     $before_menus = $this->getMenuNames();
     if ($definitions) {
         foreach ($definitions as $id => $link) {
             // Flag this link as discovered, i.e. saved via rebuild().
             $link['discovered'] = 1;
             if (!empty($link['parent'])) {
                 $children[$link['parent']][$id] = $id;
             } else {
                 // A top level link - we need them to root our tree.
                 $top_links[$id] = $id;
                 $link['parent'] = '';
             }
             $links[$id] = $link;
         }
     }
     foreach ($top_links as $id) {
         $this->saveRecursive($id, $children, $links);
     }
     // Handle any children we didn't find starting from top-level links.
     foreach ($children as $orphan_links) {
         foreach ($orphan_links as $id) {
             // Force it to the top level.
             $links[$id]['parent'] = '';
             $this->saveRecursive($id, $children, $links);
         }
     }
     // Find any previously discovered menu links that no longer exist.
     if ($definitions) {
         $query = $this->connection->select($this->table, NULL, $this->options);
         $query->addField($this->table, 'id');
         $query->condition('discovered', 1);
         $query->condition('id', array_keys($definitions), 'NOT IN');
         // Starting from links with the greatest depth will minimize the amount
         // of re-parenting done by the menu storage.
         $query->orderBy('depth', 'DESC');
         $result = $query->execute()->fetchCol();
     } else {
         $result = array();
     }
     // Remove all such items.
     if ($result) {
         $this->purgeMultiple($result);
     }
     $this->resetDefinitions();
     $affected_menus = $this->getMenuNames() + $before_menus;
     // Invalidate any cache tagged with any menu name.
     $cache_tags = Cache::buildTags('menu', $affected_menus);
     Cache::invalidateTags($cache_tags);
     $this->resetDefinitions();
     // Every item in the cache bin should have one of the menu cache tags but it
     // is not guaranteed, so invalidate everything in the bin.
     $this->menuCacheBackend->invalidateAll();
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:63,代码来源:MenuTreeStorage.php

示例3: rebuild

 /**
  * {@inheritdoc}
  */
 public function rebuild(array $definitions)
 {
     $links = array();
     $children = array();
     $top_links = array();
     // Fetch the list of existing menus, in case some are not longer populated
     // after the rebuild.
     $before_menus = $this->getMenuNames();
     if ($definitions) {
         foreach ($definitions as $id => $link) {
             // Flag this link as discovered, i.e. saved via rebuild().
             $link['discovered'] = 1;
             if (!empty($link['parent'])) {
                 $children[$link['parent']][$id] = $id;
             } else {
                 // A top level link - we need them to root our tree.
                 $top_links[$id] = $id;
                 $link['parent'] = '';
             }
             $links[$id] = $link;
         }
     }
     foreach ($top_links as $id) {
         $this->saveRecursive($id, $children, $links);
     }
     // Handle any children we didn't find starting from top-level links.
     foreach ($children as $orphan_links) {
         foreach ($orphan_links as $id) {
             // Force it to the top level.
             $links[$id]['parent'] = '';
             $this->saveRecursive($id, $children, $links);
         }
     }
     $result = $this->findNoLongerExistingLinks($definitions);
     // Remove all such items.
     if ($result) {
         $this->purgeMultiple($result);
     }
     $this->resetDefinitions();
     $affected_menus = $this->getMenuNames() + $before_menus;
     // Invalidate any cache tagged with any menu name.
     $cache_tags = Cache::buildTags('config:system.menu', $affected_menus, '.');
     $this->cacheTagsInvalidator->invalidateTags($cache_tags);
     $this->resetDefinitions();
     // Every item in the cache bin should have one of the menu cache tags but it
     // is not guaranteed, so invalidate everything in the bin.
     $this->menuCacheBackend->invalidateAll();
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:51,代码来源:MenuTreeStorage.php

示例4: invalidateAll

 /**
  * {@inheritdoc}
  */
 public function invalidateAll()
 {
     $this->markAsOutdated();
     $this->consistentBackend->invalidateAll();
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:8,代码来源:ChainedFastBackend.php

示例5: invalidateAll

 /**
  * {@inheritdoc}
  */
 public function invalidateAll()
 {
     return $this->decorated->invalidateAll();
 }
开发者ID:sedurzu,项目名称:ildeposito8,代码行数:7,代码来源:CacheBackendDecorator.php

示例6: invalidateAll

 /**
  * {@inheritdoc}
  */
 public function invalidateAll()
 {
     return $this->cacheBackend->invalidateAll();
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:7,代码来源:CacheBackendWrapper.php


注:本文中的Drupal\Core\Cache\CacheBackendInterface::invalidateAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。