本文整理匯總了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();
}