mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
Make all cache drivers singleton instances
This commit is contained in:
parent
9b71df6a01
commit
2227e0d278
10 changed files with 164 additions and 40 deletions
23
common/framework/drivers/cache/wincache.php
vendored
23
common/framework/drivers/cache/wincache.php
vendored
|
|
@ -12,15 +12,32 @@ class WinCache implements \Rhymix\Framework\Drivers\CacheInterface
|
|||
*/
|
||||
public $prefix = true;
|
||||
|
||||
/**
|
||||
* The singleton instance is stored here.
|
||||
*/
|
||||
protected static $_instance = null;
|
||||
|
||||
/**
|
||||
* Direct invocation of the constructor is not permitted.
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of the current cache driver, using the given settings.
|
||||
*
|
||||
* @param array $config
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $config)
|
||||
public static function getInstance(array $config)
|
||||
{
|
||||
|
||||
if (self::$_instance === null)
|
||||
{
|
||||
self::$_instance = new self();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +47,7 @@ class WinCache implements \Rhymix\Framework\Drivers\CacheInterface
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSupported()
|
||||
public static function isSupported()
|
||||
{
|
||||
return function_exists('wincache_ucache_get');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue