00001 <?php
00002
00003
00004
00005 class BaseCacheHeaderManager implements ICacheHeaderManager {
00006
00007
00008
00009
00010
00011
00012
00013 public function send_headers(&$content, $expirationdate, $lastmodifieddate) {
00014
00015 if (!in_array(RequestInfo::current()->method(), array('GET', 'HEAD'))) {
00016 return;
00017 }
00018
00019 $etag = md5($content);
00020
00021
00022 Common::check_if_none_match($etag);
00023 Common::check_not_modified($lastmodifieddate);
00024
00025
00026 GyroHeaders::set('Pragma', '', true);
00027 $max_age = $expirationdate - time();
00028 GyroHeaders::set('Cache-Control', $this->get_cache_control($expirationdate, $max_age), true);
00029 GyroHeaders::set('Last-Modified', $lastmodifieddate ? GyroDate::http_date($lastmodifieddate) : '', false);
00030 GyroHeaders::set('Expires', $expirationdate ? GyroDate::http_date($expirationdate) : '', false);
00031 GyroHeaders::set('Etag', $etag, true);
00032 if (Config::has_feature(Config::TESTMODE)) {
00033 GyroHeaders::set('X-Gyro-CacheHeader-Class', get_class($this), true);
00034 }
00035 }
00036
00037 protected function check_304($etag) {
00038
00039 }
00040
00041
00042
00043
00044
00045
00046
00047 protected function get_cache_control($expirationdate, $max_age) {
00048 return 'no-cache,no-store';
00049 }
00050 }