[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/cache/src/ -> lmbCachePersisterKeyDecorator.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 lmbCachePersisterKeyDecorator.

  13   *

  14   * @package cache

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

  16   */
  17  class lmbCachePersisterKeyDecorator implements lmbCachePersister
  18  {
  19    protected $persister;
  20  
  21    function __construct($persister)
  22    {
  23      $this->persister = $persister;
  24    }
  25  
  26    function getId()
  27    {
  28      return $this->persister->getId();
  29    }
  30  
  31    function put($raw_key, $value, $group = 'default')
  32    {
  33      $key = $this->_normalizeKey($raw_key);
  34      $this->persister->put($key, $value, $group);
  35    }
  36  
  37    function get($raw_key, $group = 'default')
  38    {
  39      $key = $this->_normalizeKey($raw_key);
  40      return $this->persister->get($key, $group);
  41    }
  42  
  43    function flushValue($raw_key, $group = 'default')
  44    {
  45      $key = $this->_normalizeKey($raw_key);
  46      $this->persister->flushValue($key, $group);
  47    }
  48  
  49    function flushGroup($group)
  50    {
  51      $this->persister->flushGroup($group);
  52    }
  53  
  54    function flushAll()
  55    {
  56      $this->persister->flushAll();
  57    }
  58  
  59    protected function _normalizeKey($key)
  60    {
  61      if(is_scalar($key))
  62        return $key;
  63      else
  64        return md5(serialize($key));
  65    }
  66  }
  67  ?>


Generated: Tue Oct 14 04:47:40 2008 Cross-referenced by PHPXref 0.7