Mercurial > SimpleWebPresenter
diff FileCacheSet.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 | aafc23919e79 |
| children | 23a59da90fc7 |
line wrap: on
line diff
--- a/FileCacheSet.inc Fri Oct 19 01:36:22 2012 +0200 +++ b/FileCacheSet.inc Sun Sep 14 21:11:27 2014 +0200 @@ -5,10 +5,23 @@ $cache = ScriptIncludeCache::instance(__FILE__); $cache->cache_time("${baseDir}/Logger.inc"); +class Cache { + private $max_age=0; + function setMaxAge($seconds) + { + $this->max_age=$seconds; + } + + function cacheControl() { + return array("expires" => toGMTime(time()+$this->max_age), "cache-control" => "public, max-age=$this->max_age"); + } + +}; + /** * Caches a set of file with timestamps */ -class FileCacheSet { +class FileCacheSet extends Cache { private $newest = 0; private $files = array(); private $parentCaches = array();
