Пример #1
0
 /**
  * Returns a given cache info item
  * @param $cache
  * @return array
  * @throws \Shopware\Components\Api\Exception\NotFoundException
  */
 private function getCacheInfo($cache)
 {
     switch ($cache) {
         case 'http':
             $cacheInfo = $this->cacheManager->getHttpCacheInfo();
             break;
         case 'config':
             $cacheInfo = $this->cacheManager->getConfigCacheInfo();
             break;
         case 'template':
             $cacheInfo = $this->cacheManager->getTemplateCacheInfo();
             break;
         case 'proxy':
             $cacheInfo = $this->cacheManager->getShopwareProxyCacheInfo();
             break;
         case 'doctrine-proxy':
             $cacheInfo = $this->cacheManager->getDoctrineProxyCacheInfo();
             break;
         case 'doctrine-file':
             $cacheInfo = $this->cacheManager->getDoctrineFileCacheInfo();
             break;
         default:
             throw new ApiException\NotFoundException("Cache {$cache} is not a valid cache id.");
     }
     $cacheInfo['id'] = $cache;
     return $cacheInfo;
 }
Пример #2
0
 /**
  * Clear cache action
  */
 public function clearDirectAction()
 {
     $cache = $this->Request()->getQuery('cache');
     switch ($cache) {
         case 'Config':
             $this->cacheManager->clearHttpCache();
             $this->cacheManager->clearTemplateCache();
             $this->cacheManager->clearConfigCache();
             $this->cacheManager->clearSearchCache();
             $this->cacheManager->clearProxyCache();
             break;
         default:
             break;
     }
 }
 /**
  * @param string $token
  * @param int $expiresIn
  */
 private function setAuthorizationToCache($token, $expiresIn)
 {
     //Decrease expire date by one hour (3600s) just to make sure, we don't run into an unauthorized exception.
     $this->cacheManager->getCoreCache()->save($token, self::CACHE_ID, array(), $expiresIn - 3600);
 }