Writes the Response to the cache.
protected store ( |
||
$request | A Request instance | |
$response | A Response instance |
/** * @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); }
/** * @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); }