Mercurial > SimpleWebPresenter
diff Page.inc @ 99:d98e315308cd
Improved caching of flag and sitemap.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Sun, 14 Sep 2014 21:11:27 +0200 |
| parents | 2370f4450983 |
| children | 0a33803ee026 |
line wrap: on
line diff
--- a/Page.inc Fri Oct 19 01:36:22 2012 +0200 +++ b/Page.inc Sun Sep 14 21:11:27 2014 +0200 @@ -152,14 +152,24 @@ /** * Generates an appropriate response to the request. * - * Eg. 302 NOT CHANGED, error message or the actual content + * Eg. 304 NOT CHANGED, error message or the actual content */ function genPage() { - if ($this->cacheCheck()) { - $this->cache->CheckHttpModified(); + $cacheable = $this->cacheCheck(); + if ($cacheable == Cacheable::YES) { + if (!CheckHttpModified($this->cache)) + return false; } $res = $this->generateContent(); + if ($cacheable == Cacheable::UNDETERMINED) { + $cacheable = $this->cacheCheck(); + if ($cacheable == Cacheable::YES) { + if (!CheckHttpModified($this->cache)) + return false; + } + } + if ($this->mayValidate()) { /* $request = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; @@ -190,10 +200,12 @@ function display() { $res = $this->genPage(); - foreach ($res->headers as $header => $value) { - header("${header}: ${value}"); + if ($res) { + foreach ($res->headers as $header => $value) { + header("${header}: ${value}"); + } + print $res; } - print $res; }
