function _write_cache($output) { if ($this->is_logged_in) { // don't write cache if user is logged in return false; } else { // user isn't logged in, proceed as normal parent::_write_cache($output); } }
/** * An override to the core CodeIgniter page cache writing mechanism to use APC * @param strint $output Page output * @return void */ function _write_cache($output) { if (!function_exists('apc_add')) { return parent::_write_cache($output); } log_message('debug', 'Writing APC Cache'); $CI =& get_instance(); $uri = $CI->config->item('base_url') . $CI->config->item('index_page') . $CI->uri->uri_string(); $cache_key = md5($uri); apc_store($cache_key, $output, $this->cache_expiration * 60); return; }