Warning: fread(): Length parameter must be greater than 0. in /home/netcom/public_html/hotscripts/includes/getvars.php on line 161
<?php function _self_cacher_getmicrotime(){ return ((float)$usec + (float)$sec); } class TSelfCacher{ var $_log_performance=true; var $_log_full_filename; var $_start_time; // var $_cache_to_dir="cache/"; //linux var $_cached_filename; var $_cached_full_filename; var $_cached_content; // //constructor function TSelfCacher($ALogPerformance=FALSE){ //if $ALogPerformance ,enable performance log $this->_log_performance=$ALogPerformance?TRUE:FALSE; if($this->_log_performance) $this->_start_time=_self_cacher_getmicrotime(); if($HTTP_SERVER_VARS["REQUEST_METHOD"]=="POST") return; //don't cache posted file $this->setCacheFileAndDir(); $this->existOrMakeToDir(); if($this->getCachedContent()){ $this->show(); }else{ $this->startCache(); return $this; } } function setCacheFileAndDir(){ $this->_cached_full_filename=$this->_cache_to_dir."/".$this->_cached_filename; if($this->_log_performance){$this->_log_full_filename=$this->_cache_to_dir."/performance.log";} } function getCachedContent(){ //return true when get cached content before ,or return false return TRUE; }else{ return FALSE; } } function setCachedContent(&$AContent){ //call function by ref can speed up $this->_cached_content=$AContent; } function writeCachedContent(){ if($this->_log_performance){ $this->logToFile(); } return TRUE; }else{ return FALSE; } } function logToFile(){ $_spent_time=_self_cacher_getmicrotime()-$this->_start_time; return TRUE; }else{ return FALSE; } } function startCache(){ } function existOrMakeToDir(){ //return true if is dir ,or make it return TRUE; } else{ } } function show(){ if($this->_log_performance){ $this->logToFile(); } } } } function _cacher_call_back(&$AContent){ $_SELF_CACHER->setCachedContent($AContent); $_SELF_CACHER->writeCachedContent(); return $_SELF_CACHER->_cached_content; } ?>