當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CacheBackendInterface::setMultiple方法代碼示例

本文整理匯總了PHP中Drupal\Core\Cache\CacheBackendInterface::setMultiple方法的典型用法代碼示例。如果您正苦於以下問題:PHP CacheBackendInterface::setMultiple方法的具體用法?PHP CacheBackendInterface::setMultiple怎麽用?PHP CacheBackendInterface::setMultiple使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Cache\CacheBackendInterface的用法示例。


在下文中一共展示了CacheBackendInterface::setMultiple方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: readMultiple

 /**
  * {@inheritdoc}
  */
 public function readMultiple(array $names)
 {
     $data_to_return = array();
     $cache_keys_map = $this->getCacheKeys($names);
     $cache_keys = array_values($cache_keys_map);
     $cached_list = $this->cache->getMultiple($cache_keys);
     if (!empty($cache_keys)) {
         // $cache_keys_map contains the full $name => $cache_key map, while
         // $cache_keys contains just the $cache_key values that weren't found in
         // the cache.
         // @see \Drupal\Core\Cache\CacheBackendInterface::getMultiple()
         $names_to_get = array_keys(array_intersect($cache_keys_map, $cache_keys));
         $list = $this->storage->readMultiple($names_to_get);
         // Cache configuration objects that were loaded from the storage, cache
         // missing configuration objects as an explicit FALSE.
         $items = array();
         foreach ($names_to_get as $name) {
             $data = isset($list[$name]) ? $list[$name] : FALSE;
             $data_to_return[$name] = $data;
             $items[$cache_keys_map[$name]] = array('data' => $data);
         }
         $this->cache->setMultiple($items);
     }
     // Add the configuration objects from the cache to the list.
     $cache_keys_inverse_map = array_flip($cache_keys_map);
     foreach ($cached_list as $cache_key => $cache) {
         $name = $cache_keys_inverse_map[$cache_key];
         $data_to_return[$name] = $cache->data;
     }
     // Ensure that only existing configuration objects are returned, filter out
     // cached information about missing objects.
     return array_filter($data_to_return);
 }
開發者ID:davidsoloman,項目名稱:drupalconsole.com,代碼行數:36,代碼來源:CachedStorage.php

示例2: readMultiple

 /**
  * {@inheritdoc}
  */
 public function readMultiple(array $names)
 {
     $list = array();
     // The names array is passed by reference and will only contain the names of
     // config object not found after the method call.
     // @see \Drupal\Core\Cache\CacheBackendInterface::getMultiple()
     $cached_list = $this->cache->getMultiple($names);
     if (!empty($names)) {
         $list = $this->storage->readMultiple($names);
         // Cache configuration objects that were loaded from the storage, cache
         // missing configuration objects as an explicit FALSE.
         $items = array();
         foreach ($names as $name) {
             $items[$name] = array('data' => isset($list[$name]) ? $list[$name] : FALSE);
         }
         $this->cache->setMultiple($items);
     }
     // Add the configuration objects from the cache to the list.
     foreach ($cached_list as $name => $cache) {
         $list[$name] = $cache->data;
     }
     // Ensure that only existing configuration objects are returned, filter out
     // cached information about missing objects.
     return array_filter($list);
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:28,代碼來源:CachedStorage.php

示例3: setMultiple

 /**
  * {@inheritdoc}
  */
 public function setMultiple(array $items)
 {
     $this->consistentBackend->setMultiple($items);
     $this->markAsOutdated();
     // Don't write the cache tags to the fast backend as any cache tag
     // invalidation results in an invalidation of the whole fast backend.
     foreach ($items as &$item) {
         unset($item['tags']);
     }
     $this->fastBackend->setMultiple($items);
 }
開發者ID:nstielau,項目名稱:drops-8,代碼行數:14,代碼來源:ChainedFastBackend.php

示例4: setMultiple

 /**
  * {@inheritdoc}
  */
 public function setMultiple(array $items)
 {
     $this->markAsOutdated();
     $this->consistentBackend->setMultiple($items);
     $this->fastBackend->setMultiple($items);
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:9,代碼來源:ChainedFastBackend.php

示例5: setMultiple

 /**
  * {@inheritdoc}
  */
 public function setMultiple(array $items)
 {
     return $this->cacheBackend->setMultiple($items);
 }
開發者ID:ddrozdik,項目名稱:dmaps,代碼行數:7,代碼來源:CacheBackendWrapper.php


注:本文中的Drupal\Core\Cache\CacheBackendInterface::setMultiple方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。