mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 04:24:14 +09:00
Use file cache if no other cache is configured
This commit is contained in:
parent
6618593a11
commit
273671cf4e
1 changed files with 11 additions and 11 deletions
|
|
@ -25,11 +25,7 @@ class Cache
|
||||||
*/
|
*/
|
||||||
public static function init($config)
|
public static function init($config)
|
||||||
{
|
{
|
||||||
if (!$config)
|
if (!is_array($config))
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
elseif (!is_array($config))
|
|
||||||
{
|
{
|
||||||
$config = array($config);
|
$config = array($config);
|
||||||
}
|
}
|
||||||
|
|
@ -44,12 +40,16 @@ class Cache
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return;
|
$class_name = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (class_exists($class_name) && $class_name::isSupported())
|
if (class_exists($class_name) && $class_name::isSupported())
|
||||||
{
|
{
|
||||||
self::$_driver = new $class_name($config);
|
return self::$_driver = new $class_name($config);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return self::$_driver = new Drivers\Cache\File(array());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ class Cache
|
||||||
{
|
{
|
||||||
if (self::$_driver !== null)
|
if (self::$_driver !== null)
|
||||||
{
|
{
|
||||||
return self::$_driver::get(self::getRealKey($key, $group_name));
|
return self::$_driver->get(self::getRealKey($key, $group_name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -135,7 +135,7 @@ class Cache
|
||||||
{
|
{
|
||||||
if (self::$_driver !== null)
|
if (self::$_driver !== null)
|
||||||
{
|
{
|
||||||
return self::$_driver::set(self::getRealKey($key, $group_name), $value, intval($ttl)) ? true : false;
|
return self::$_driver->set(self::getRealKey($key, $group_name), $value, intval($ttl)) ? true : false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -157,7 +157,7 @@ class Cache
|
||||||
{
|
{
|
||||||
if (self::$_driver !== null)
|
if (self::$_driver !== null)
|
||||||
{
|
{
|
||||||
return self::$_driver::delete(self::getRealKey($key, $group_name)) ? true : false;
|
return self::$_driver->delete(self::getRealKey($key, $group_name)) ? true : false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -178,7 +178,7 @@ class Cache
|
||||||
{
|
{
|
||||||
if (self::$_driver !== null)
|
if (self::$_driver !== null)
|
||||||
{
|
{
|
||||||
return self::$_driver::exists(self::getRealKey($key, $group_name)) ? true : false;
|
return self::$_driver->exists(self::getRealKey($key, $group_name)) ? true : false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue