[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/cache/src/ -> lmbCacheMemoryPersister.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require('limb/cache/src/lmbCachePersister.interface.php');
  10  
  11  /**

  12   * class lmbCacheMemoryPersister.

  13   *

  14   * @package cache

  15   * @version $Id: lmbCacheMemoryPersister.class.php 5945 2007-06-06 08:31:43Z pachanga $

  16   */
  17  class lmbCacheMemoryPersister implements lmbCachePersister
  18  {
  19    protected $cache = array();
  20    protected $id;
  21  
  22    function __construct($id = 'cache')
  23    {
  24      $this->id = $id;
  25    }
  26  
  27    function getId()
  28    {
  29      return $this->id;
  30    }
  31  
  32    function put($key, $value, $group = 'default')
  33    {
  34      $this->cache[$group][$key] = $value;
  35    }
  36  
  37    function get($key, $group = 'default')
  38    {
  39      if(isset($this->cache[$group]) &&
  40         array_key_exists($key, $this->cache[$group]))
  41      {
  42        return $this->cache[$group][$key];
  43      }
  44  
  45      return LIMB_CACHE_NULL_RESULT;
  46    }
  47  
  48    function flushValue($key, $group = 'default')
  49    {
  50      if(isset($this->cache[$group][$key]))
  51        unset($this->cache[$group][$key]);
  52    }
  53  
  54    function flushGroup($group)
  55    {
  56      if(isset($this->cache[$group]))
  57        $this->cache[$group] = array();
  58    }
  59  
  60    function flushAll()
  61    {
  62      $this->cache = array();
  63    }
  64  }
  65  ?>


Generated: Sat Sep 6 04:46:52 2008 Cross-referenced by PHPXref 0.7