/** * Processes the request, checking for attached * Cache decorators. If decorators are found, * the request performs the following tasks. * * 1. Checks for existing cached response, returning valid hits * 2. Runs the Kohana_Request::execute() logic to create a response * 3. Caches the response using a decorator if valid * * $request->execute(); * * @return Kohana_Response * @throws Kohana_Exception * @uses [Kohana::$profiling] * @uses [Profiler] * @uses [Request_Cache] */ public function execute() { // If there are no cache adaptors if (!Request::$cache->cache_decorators) { // Get out of here return parent::execute(); } // Create the cache key $key = $this->create_cache_key($this->uri()); // Try and retrieve a cached response $response = Request::$cache->get($key); // If a response is returned if ($response instanceof Kohana_Response) { // Return the cached response return $response; } else { // Execute the contoller to get the response $response = parent::execute(); } // If the response method is in the allow list if (!in_array($this->method, Request_Cache::$cache_methods_allow)) { // return FALSE return $response; } else { if (!Request_Cache::validate_set($response)) { // return the non-cached result return $response; } } // Set the response to cache Request::$cache->set($key, $response); // Return the response return $response; }