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


PHP Cache::getStorage方法代碼示例

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


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

示例1: compile

 /**
  * @param Translator $translator
  * @param MessageCatalogueInterface[] $availableCatalogues
  * @param string $locale
  * @throws InvalidArgumentException
  * @return MessageCatalogueInterface|NULL
  */
 public function compile(Translator $translator, array &$availableCatalogues, $locale)
 {
     if (empty($locale)) {
         throw new InvalidArgumentException("Invalid locale.");
     }
     if (isset($availableCatalogues[$locale])) {
         return $availableCatalogues;
     }
     $cacheKey = array($locale, $translator->getFallbackLocales());
     $storage = $this->cache->getStorage();
     if (!$storage instanceof Kdyby\Translation\Caching\PhpFileStorage) {
         if (($messages = $this->cache->load($cacheKey)) !== NULL) {
             $availableCatalogues[$locale] = new MessageCatalogue($locale, $messages);
             return $availableCatalogues;
         }
         $this->catalogueFactory->createCatalogue($translator, $availableCatalogues, $locale);
         $this->cache->save($cacheKey, $availableCatalogues[$locale]->all());
         return $availableCatalogues;
     }
     $storage->hint = $locale;
     $cached = $compiled = $this->cache->load($cacheKey);
     if ($compiled === NULL) {
         $this->catalogueFactory->createCatalogue($translator, $availableCatalogues, $locale);
         $this->cache->save($cacheKey, $compiled = $this->compilePhpCache($translator, $availableCatalogues, $locale));
         $cached = $this->cache->load($cacheKey);
     }
     $availableCatalogues[$locale] = self::load($cached['file']);
     return $availableCatalogues;
 }
開發者ID:tomasstrejcek,項目名稱:Translation,代碼行數:36,代碼來源:CatalogueCompiler.php

示例2: createGroupedSelectionInstance

 protected function createGroupedSelectionInstance($table, $column)
 {
     return new GroupedSelection($this->context, $this->conventions, $table, $column, $this, $this->cache ? $this->cache->getStorage() : NULL);
 }
開發者ID:jave007,項目名稱:test,代碼行數:4,代碼來源:Selection.php

示例3: createSelectionInstance

 public function createSelectionInstance($table = NULL)
 {
     return new Selection($this->connection, $table ?: $this->name, $this->reflection, $this->cache ? $this->cache->getStorage() : NULL);
 }
開發者ID:jurasm2,項目名稱:nette,代碼行數:4,代碼來源:Selection.php

示例4: getCacheStorage

 /** @return NIStorage */
 static function getCacheStorage()
 {
     return self::$cache->getStorage();
 }
開發者ID:uestla,項目名稱:aliaser,代碼行數:5,代碼來源:Container.php


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