cache = array(); } /* static */ function &getInstance() { static $_instance; if (!is_object($_instance)) { $_instance = new Core_Cache(); } return $_instance; } /* static */ function get( $key, $default = null ) { return self::getInstance()->_get( $key, $default ); } /* static */ function get_and_clean( $key, $default = null ) { return self::getInstance()->_get_and_clean( $key, $default ); } /* static */ function set( $key, $value ) { return self::getInstance()->_set( $key, $value ); } function &_get( $key, $default = null ) { $null = null; if ($key === null) return $null; if (array_key_exists($key, $this->cache)) { return $this->cache[ $key ]; } else { return $default; } } function &_get_and_clean( $key, $default = null ) { if (array_key_exists($key, $this->cache)) { $ret = $this->cache[ $key ]; unset($this->cache[ $key ]); return $ret; } else { return $default; } } function _set( $key, $value ) { $this->cache [ $key ] = $value; return true; } function dbg() { return self::_('dbg','all','values'); } }// class