store() protected method

Writes the Response to the cache.
protected store ( Request $request, Response $response )
$request Symfony\Component\HttpFoundation\Request A Request instance
$response Symfony\Component\HttpFoundation\Response A Response instance
Esempio n. 1
0
 /**
  * @param  Request  $request
  * @param  Response $response
  * @throws \Exception
  */
 protected function store(Request $request, Response $response)
 {
     // Not cache sites with nocache header
     if ($this->containsNoCacheTag($request, $response)) {
         return;
     }
     parent::store($request, $response);
 }
 /**
  * {@inheritDoc}
  *
  * Trigger event to alter response before storing it in the cache.
  */
 protected function store(Request $request, Response $response)
 {
     if ($this->getEventDispatcher()->hasListeners(Events::PRE_STORE)) {
         $event = new CacheEvent($this, $request, $response);
         $this->getEventDispatcher()->dispatch(Events::PRE_STORE, $event);
         $response = $event->getResponse();
     }
     parent::store($request, $response);
 }
Esempio n. 3
0
 /**
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @param \Symfony\Component\HttpFoundation\Response $response
  * @throws \Exception
  */
 protected function store(Request $request, Response $response)
 {
     //Not cache sites with nocache header
     if ($response->headers->has('x-shopware-allow-nocache')
         && $request->cookies->has('nocache')) {
         $cacheTag = $response->headers->get('x-shopware-allow-nocache');
         $cacheTag = explode(', ', $cacheTag);
         foreach($cacheTag as $cacheTagValue) {
             if(strpos($request->cookies->get('nocache'), $cacheTagValue) !== false) {
                 return;
             }
         }
     }
     return parent::store($request, $response);
 }