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


PHP CacheBackendInterface::garbageCollection方法代码示例

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


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

示例1: cacheClearing

 /**
  * Submit handler to demonstrate the various uses of cache_clear_all().
  */
 public function cacheClearing($form, &$form_state)
 {
     switch ($form_state->getValue('cache_clear_type')) {
         case 'expire':
             // Here we'll remove all cache keys in the 'cache' bin that have
             // expired.
             $this->cacheBackend->garbageCollection();
             drupal_set_message($this->t('\\Drupal::cache()->garbageCollection() was called, removing any expired cache items.'));
             break;
         case 'remove_all':
             // This removes all keys in a bin using a super-wildcard. This
             // has nothing to do with expiration. It's just brute-force removal.
             $this->cacheBackend->deleteAll();
             drupal_set_message($this->t('ALL entries in the "cache" bin were removed with \\Drupal::cache()->deleteAll().'));
             break;
         case 'remove_tag':
             // This removes cache entries with the tag "cache_example" set to 1 in
             // the "cache".
             $tags = array('cache_example:1');
             Cache::invalidateTags($tags);
             drupal_set_message($this->t('Cache entries with the tag "cache_example" set to 1 in the "cache" bin were invalidated with \\Drupal\\Core\\Cache\\Cache::invalidateTags($tags).'));
             break;
     }
 }
开发者ID:viljaste,项目名称:viljaste.xyz,代码行数:27,代码来源:CacheExampleForm.php

示例2: garbageCollection

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

示例3: garbageCollection

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

示例4: garbageCollection

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


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