diff --git a/src/Pluf/Cache.php b/src/Pluf/Cache.php index 4e2f39e..ab794ad 100644 --- a/src/Pluf/Cache.php +++ b/src/Pluf/Cache.php @@ -57,7 +57,10 @@ class Pluf_Cache if (false == ($engine = Pluf::f('cache_engine', false))) { throw new Pluf_Exception_SettingError('"cache_engine" setting not defined.'); } - return new $engine(); + if (!isset($GLOBALS['_PX_Pluf_Cache-'.$engine])) { + $GLOBALS['_PX_Pluf_Cache-'.$engine] = new $engine(); + } + return $GLOBALS['_PX_Pluf_Cache-'.$engine]; } /** diff --git a/src/Pluf/Cache/File.php b/src/Pluf/Cache/File.php index e49b84b..d06b0ad 100644 --- a/src/Pluf/Cache/File.php +++ b/src/Pluf/Cache/File.php @@ -29,7 +29,7 @@ */ class Pluf_Cache_File extends Pluf_Cache { - public function __constructor() + public function __construct() { if (false == Pluf::f('cache_file_folder', false)) { throw new Pluf_Exception_SettingError('"cache_file_folder" setting not defined.'); diff --git a/src/Pluf/Cache/Memcached.php b/src/Pluf/Cache/Memcached.php index 91adcfd..986e322 100644 --- a/src/Pluf/Cache/Memcached.php +++ b/src/Pluf/Cache/Memcached.php @@ -42,11 +42,11 @@ class Pluf_Cache_Memcached extends Pluf_Cache private $memcache = null; private $keyprefix = ''; - public function __constructor() + public function __construct() { $this->memcache = memcache_connect(Pluf::f('cache_memcached_server', 'localhost'), Pluf::f('cache_memcached_port', 11211)); - if (false == $this->memcache) { + if (false === $this->memcache) { $this->memcache = null; } $this->keyprefix = Pluf::f('cache_memcached_keyprefix', '');