CI_Output::cache PHP Method

cache() public method

Set Cache
public cache ( integer $time ) : CI_Output
$time integer Cache expiration time in minutes
return CI_Output
    public function cache($time)
    {
        $this->cache_expiration = is_numeric($time) ? $time : 0;
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 public function cache($minute)
 {
     if (ENVIRONMENT == 'development') {
         return;
     }
     require_once APPPATH . 'hooks/cache_override.php';
     parent::cache($minute);
     $offset = $minute * 60;
     // calc the string in GMT not localtime and add the offset
     $this->set_header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + $offset));
     $this->set_header('Cache-Control: max-age=' . $offset);
     header_remove('Pragma');
     $this->cacheable();
     $this->cache_instance = new Cache_Override();
     $this->cache_instance->lock();
 }