/**
  * If this url allows caching and there is a cached response then send it
  * @param  SS_HTTPRequest $request
  * @param  Session        $session
  * @param  DataModel      $model
  * @return bool|void
  */
 public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model)
 {
     if ($this->allowFetch($request)) {
         \Versioned::choose_site_stage();
         if ($request->getURL() == '') {
             $request = clone $request;
             $request->setUrl('home');
         }
         $response = $this->cache->get($this->name, \Injector::inst()->create('CacheIncludeKeyCreator', $this->getController($request)));
         if ($response instanceof SS_HTTPResponse) {
             // replace in body
             if ($this->hasTokens()) {
                 $body = $response->getBody();
                 foreach ($this->tokens as $token) {
                     $name = self::REPLACED_TOKEN_PREFIX . $token->getName();
                     if (strpos($body, $name) !== false) {
                         $body = str_replace($name, $token->getValue(), $body);
                     }
                 }
                 $response->setBody($body);
             }
             $session->save();
             $response->output();
             exit;
         }
     }
     return true;
 }