当前位置: 首页>>代码示例>>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;未经允许,请勿转载。