/ */ class P4Cms_Cache_Backend_File extends Zend_Cache_Backend_File { /** * Extend parent to add the 'namespace' option. * * @param array $options associative array of options */ public function __construct(array $options = array()) { $this->_options['namespace'] = false; return parent::__construct($options); } /** * Extends parent to work the 'namespace' option into the * existing 'file_name_prefix' option. * * @param string $name the option name * @param mixed $value the options value */ public function setOption($name, $value) { // if we aren't touching a related setting let parent handle it if ($name != 'namespace' && $name != 'file_name_prefix') { parent::setOption($name, $value); return; } // pull out references to the namespace and file_name_prefix // then calculate our current namespaced based suffix. $namespace =& $this->_options['namespace']; $prefix =& $this->_options['file_name_prefix']; $suffix = $namespace ? ('_' . md5($namespace)) : ''; // strip the current namespace based suffix from the file // name prefix if its present if (substr($prefix, strlen($suffix) * -1) == $suffix) { $prefix = substr($prefix, 0, strlen($prefix) - strlen($suffix)); } // let parent update the namespace/file_name_prefix parent::setOption($name, $value); // namespace may have changed; re-calculate suffix and // tack it onto our file_name_prefix $suffix = $namespace ? ('_' . md5($namespace)) : ''; $this->_options['file_name_prefix'] = $prefix . $suffix; } }