getStorage() public method

Returns cache storage.
public getStorage ( ) : Nette\Caching\IStorage
return Nette\Caching\IStorage
 /**
  * @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;
 }
Esempio n. 2
0
 protected function createGroupedSelectionInstance($table, $column)
 {
     return new GroupedSelection($this->context, $this->conventions, $table, $column, $this, $this->cache ? $this->cache->getStorage() : NULL);
 }
Esempio n. 3
0
 public function createSelectionInstance($table = NULL)
 {
     return new Selection($this->connection, $table ?: $this->name, $this->reflection, $this->cache ? $this->cache->getStorage() : NULL);
 }
Esempio n. 4
0
 /** @return NIStorage */
 static function getCacheStorage()
 {
     return self::$cache->getStorage();
 }