/** * Determine if the given widget should be cached. * * @param \ZEDx\Widget $widget * @param \Symfony\Component\HttpFoundation\Response $response * * @return bool */ public function shouldCache(Widget $widget, Response $response) { if (!env('APP_CACHE', true)) { return false; } if (!$widget->cache()) { return false; } return $this->cacheProfile->shouldCacheResponse($response); }
/** * Determine if the given request should be cached. * * @param \Illuminate\Http\Request $request * @param \Symfony\Component\HttpFoundation\Response $response * * @return bool */ public function shouldCache(Request $request, Response $response) { if (!env('APP_CACHE', true)) { return false; } if ($request->attributes->has('zedx-cache.doNotCache')) { return false; } if (!$this->cacheProfile->shouldCacheRequest($request)) { return false; } return $this->cacheProfile->shouldCacheResponse($response); }