/** * Constructor * * Set the amount of time to cache. * * @access public * @return object HTTP_Header_Cache * @param int $expires * @param string $unit */ function HTTP_Header_Cache($expires = 0, $unit = 'seconds') { parent::HTTP_Header(); $this->setHeader('Pragma', 'cache'); $this->setHeader('Cache-Control', 'public'); $this->setHeader('Last-Modified', $this->getCacheStart()); if ($expires && !$this->isOlderThan($expires, $unit)) { $this->exitIfCached(); } }
/** * Constructor * * Set the amount of time to cache. * * @access public * @return object HTTP_Header_Cache * @param int $expires * @param string $unit */ function HTTP_Header_Cache($expires = 0, $unit = 'seconds') { parent::HTTP_Header(); $this->setHeader('Pragma', 'cache'); $this->setHeader('Last-Modified', $this->getCacheStart()); $this->setHeader('Cache-Control', 'private, must-revalidate, max-age=0'); if ($expires) { if (!$this->isOlderThan($expires, $unit)) { $this->exitCached(); } $this->setHeader('Last-Modified', time()); } }