當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。