本文整理汇总了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;
}
示例2: createGroupedSelectionInstance
protected function createGroupedSelectionInstance($table, $column)
{
return new GroupedSelection($this->context, $this->conventions, $table, $column, $this, $this->cache ? $this->cache->getStorage() : NULL);
}
示例3: createSelectionInstance
public function createSelectionInstance($table = NULL)
{
return new Selection($this->connection, $table ?: $this->name, $this->reflection, $this->cache ? $this->cache->getStorage() : NULL);
}
示例4: getCacheStorage
/** @return NIStorage */
static function getCacheStorage()
{
return self::$cache->getStorage();
}