cache = array(); } public static function &getInstance() { static $_instance; if (!is_object($_instance)) { $_instance = new Core_Cache(); } return $_instance; } public static function get($key, $default = null) { return self::getInstance()->_get($key, $default); } public static function get_and_clean($key, $default = null) { return self::getInstance()->_get_and_clean($key, $default); } public static function set($key, $value) { return self::getInstance()->_set($key, $value); } public 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; } } public 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; } } public function _set($key, $value) { $this->cache[$key] = $value; return true; } public function dbg() { return self::_('dbg','all','values'); } }