comparison 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
comparison
equal deleted inserted replaced
98:f2d52fed708c 99:d98e315308cd
3 3
4 include_once 'Logger.inc'; 4 include_once 'Logger.inc';
5 $cache = ScriptIncludeCache::instance(__FILE__); 5 $cache = ScriptIncludeCache::instance(__FILE__);
6 $cache->cache_time("${baseDir}/Logger.inc"); 6 $cache->cache_time("${baseDir}/Logger.inc");
7 7
8 class Cache {
9 private $max_age=0;
10 function setMaxAge($seconds)
11 {
12 $this->max_age=$seconds;
13 }
14
15 function cacheControl() {
16 return array("expires" => toGMTime(time()+$this->max_age), "cache-control" => "public, max-age=$this->max_age");
17 }
18
19 };
20
8 /** 21 /**
9 * Caches a set of file with timestamps 22 * Caches a set of file with timestamps
10 */ 23 */
11 class FileCacheSet { 24 class FileCacheSet extends Cache {
12 private $newest = 0; 25 private $newest = 0;
13 private $files = array(); 26 private $files = array();
14 private $parentCaches = array(); 27 private $parentCaches = array();
15 28
16 /** 29 /**