Source for file object_cached.class.php

Documentation is available at object_cached.class.php

  1. <?php   /*
  2.    *@=@=@=@ START LICENSE @=@=@=@*
  3.    Copyright or © or Copr. Stéphane TRICHET and Nicolas SOTRON
  4.    
  5.    stephane.t@simpliciweb.net and nicolas.s@simpliciweb.net
  6.    
  7.    This software is a computer program whose purpose is to make a
  8.    web hosting platform
  9.    
  10.    This software is governed by the CeCILL  license under French law and
  11.    abiding by the rules of distribution of free software.  You can  use, 
  12.    modify and/ or redistribute the software under the terms of the CeCILL
  13.    license as circulated by CEA, CNRS and INRIA at the following URL
  14.    "http://www.cecill.info". 
  15.    
  16.    As a counterpart to the access to the source code and  rights to copy,
  17.    modify and redistribute granted by the license, users are provided only
  18.    with a limited warranty  and the software's author,  the holder of the
  19.    economic rights,  and the successive licensors  have only  limited
  20.    liability. 
  21.    
  22.    In this respect, the user's attention is drawn to the risks associated
  23.    with loading,  using,  modifying and/or developing or reproducing the
  24.    software by the user in light of its specific status of free software,
  25.    that may mean  that it is complicated to manipulate,  and  that  also
  26.    therefore means  that it is reserved for developers  and  experienced
  27.    professionals having in-depth computer knowledge. Users are therefore
  28.    encouraged to load and test the software's suitability as regards their
  29.    requirements in conditions enabling the security of their systems and/or 
  30.    data to be ensured and,  more generally, to use and operate it in the 
  31.    same conditions as regards security. 
  32.    
  33.    The fact that you are presently reading this means that you have had
  34.    knowledge of the CeCILL license and that you accept its terms.
  35.    *@=@=@=@ END   LICENSE @=@=@=@*
  36.  
  37. */?><?php  
  38.  
  39. /**
  40.  * ObjectCached Class
  41.  * 
  42.  * 
  43.  * @author SimpliciWeb
  44.  * @version $Id: object_cached.class.php 602 2007-07-18 16:18:38Z stephanet $
  45.  * @package Common
  46.  * @subpackage FrameWork
  47.  */    
  48. /**
  49.  * Any class wich extend ObjectCached can use a function cache using xRemembered, etc.
  50.  *
  51.  * @author SimpliciWeb
  52.  * @version $Id: object_cached.class.php 602 2007-07-18 16:18:38Z stephanet $
  53.  * @package Common
  54.  * @subpackage FrameWork
  55.  */
  56.  
  57. class ObjectCached {
  58.     
  59.  
  60.     /**
  61.      * The array of the memorized informations
  62.      *
  63.      * @var array 
  64.      */
  65.     var $m_array_already_loader = array();
  66.  
  67.  
  68.     /**
  69.      * Test if it is remembered result and pass it by reference
  70.      *
  71.      * @param string $p_key 
  72.      * @param mixed $r_rememberded_value 
  73.      * @return bool TRUE = is remembered, FALSE = not finded
  74.      */
  75.     function xIsRemembered($p_key&$r_rememberded_value{
  76.         $r_rememberded_value "";
  77.         
  78.         if (isset($this->m_array_already_loader[$p_key])) {
  79.                 global $g_object_time_elapser;
  80.                 $id $g_object_time_elapser->beginningCacheClass("Cache Class Using");
  81.                 $r_rememberded_value $this->m_array_already_loader[$p_key];
  82.                 $g_object_time_elapser->endingCacheClass($id);
  83.                 return true;
  84.         else {
  85.             return false;    
  86.         }
  87.                 
  88.     }
  89.  
  90.     /**
  91.      * Force to remember a result
  92.      *
  93.      * @param string $p_key 
  94.      * @param mixed $p_value 
  95.      */
  96.     function xRemember($p_key$p_value{
  97.         $this->m_array_already_loader[$p_key$p_value;
  98.     }
  99.     
  100.     /**
  101.      * Clear a remembered result by key
  102.      *
  103.      * @param string $p_key 
  104.      */
  105.     function xClearRemember($p_key{
  106.         if (isset($this->m_array_already_loader[$p_key]))
  107.             unset($this->m_array_already_loader[$p_key]);
  108.     }        
  109.  
  110.     /**
  111.      * Clear all
  112.      *
  113.      */
  114.     function xClearRememberAll({
  115.         $this->m_array_already_loader = array();
  116.     }        
  117.     
  118. }
  119.  
  120.  
  121.  
  122.  
  123. ?>

Documentation generated on Tue, 25 Mar 2008 15:35:19 +0100 by phpDocumentor 1.3.2