Memcache caching, #18

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/evo@120 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
pzinovkin
2010-03-05 18:41:02 +00:00
parent 00259cfe93
commit 2d7f5391f8
6 changed files with 287 additions and 21 deletions

View File

@ -26,17 +26,17 @@ class Config extends ArrayObject
*/
static public function getInstance()
{
if (! isset(self::$_instance)) {
if (!isset(self::$_instance)) {
self::$_instance = new Config();
}
return self::$_instance;
}
static public function get($name)
static public function get($name, $default = null)
{
$instance = self::getInstance();
if (! $instance->offsetExists($name)) {
throw new Exception('Configuration variable "' . $name . '" undefined');
if (!$instance->offsetExists($name)) {
return $default;
}
return $instance->offsetGet($name);
}
@ -59,7 +59,7 @@ class ConfigArray extends ArrayObject
public function offsetGet($index)
{
if (! $this->offsetExists($index)) {
if (!$this->offsetExists($index)) {
throw new Exception('Configuration variable "' . $index . '" undefined');
}
return parent::offsetGet($index);