File indexing completed on 2024-05-12 17:26:16

0001 <?php
0002 
0003 /*
0004  *   TRT GFX 3.0.1 (beta build) BackToSlash
0005  * 
0006  *   support: happy.snizzo@gmail.com
0007  *   website: http://trt-gfx.googlecode.com
0008  *   credits: Claudio Desideri
0009  *   
0010  *   This software is released under the MIT License.
0011  *   http://opensource.org/licenses/mit-license.php
0012  */ 
0013 
0014 class ECacheEngine {
0015   
0016   private $main;
0017   
0018   private $cached;
0019   private $requested_page;
0020   
0021   public function __construct(){
0022     global $main;
0023     $this->main = $main;
0024     
0025     $this->cached = new EData("cached",$this->main);
0026     $this->requested_page = get_script_name();
0027   }
0028   
0029   public function exists_cache(){
0030     if($this->cached->count("script","script='".$this->requestedpage."'")){
0031       return true;
0032     } else {
0033       return false;
0034     }
0035   }
0036   /*
0037    * update cache using sha1_file
0038    */
0039   public function update_cache(){
0040     //
0041   }
0042   
0043   public function generate_cache(){
0044     //
0045   }
0046   
0047   public function get_cache(){
0048     if($this->exists_cache()){
0049       $this->cached->row("content","script='".$this->requested_page."'");
0050     } else {
0051       $this->main->log->warning("requested a cache for a non-cached page in ".$this->requested_page);
0052     }
0053   }
0054   
0055   public function get_script_name(){
0056     $script = $_SERVER['SCRIPT_NAME'];
0057     return $script;
0058   }
0059 }
0060 
0061 ?>