rendered paste bodyclass cache { // Using Xcache var $content; var $capture; var $id; var $timeout; function cache($id=false) { if($id!==false) $this->id=$id; $this->capture=false; $this->content=false; } function setid($id) { $this->id=$id; $this->content=false; } function check() { $tmp=xcache_get($this->id); if(is_array($tmp)) { $this->content=$tmp[1]; return $tmp[0]; } return false; } function get() { echo "\r\n<!-- Cached Begin -->\r\n"; if($this->content!==false) { echo $this->content; } else { $tmp=xcache_get($this->id); if(is_array($tmp)) echo $tmp[1]; } echo "\r\n<!-- Cached End -->\r\n"; } function capture_start($value=false,$timeout=86400) { $this->capture=true; $this->timeout=$timeout; if($value===false) $this->value=time(); else $this->value=$value; ob_start(); return true; } function capture_stop() { if($this->capture) { xcache_unset($this->id); $tmp[0]=$this->value; $tmp[1]=ob_get_contents(); xcache_set($this->id,$tmp,$this->timeout); ob_end_flush(); $this->capture=false; $this->content=false; } }}