mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-11 21:12:15 +09:00
Disable file cache driver
This commit is contained in:
parent
84546b936c
commit
8234fd5c7b
3 changed files with 16 additions and 7 deletions
|
|
@ -51,7 +51,7 @@ class Cache
|
||||||
}
|
}
|
||||||
$config = isset($config['servers']) ? $config['servers'] : array();
|
$config = isset($config['servers']) ? $config['servers'] : array();
|
||||||
}
|
}
|
||||||
elseif (preg_match('/^(apc|dummy|file|memcache|redis|sqlite|wincache|xcache)/', strval(array_first($config)), $matches))
|
elseif (preg_match('/^(apc|dummy|memcached?|redis|sqlite|wincache|xcache)/', strval(array_first($config)), $matches))
|
||||||
{
|
{
|
||||||
$driver_name = $matches[1] . ($matches[1] === 'memcache' ? 'd' : '');
|
$driver_name = $matches[1] . ($matches[1] === 'memcache' ? 'd' : '');
|
||||||
$class_name = '\\Rhymix\\Framework\\Drivers\\Cache\\' . $driver_name;
|
$class_name = '\\Rhymix\\Framework\\Drivers\\Cache\\' . $driver_name;
|
||||||
|
|
@ -62,7 +62,7 @@ class Cache
|
||||||
$class_name = null;
|
$class_name = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($class_name && class_exists($class_name) && $class_name::isSupported())
|
if ($class_name !== null && $driver_name !== 'file' && class_exists($class_name) && $class_name::isSupported())
|
||||||
{
|
{
|
||||||
self::$_driver = $class_name::getInstance($config);
|
self::$_driver = $class_name::getInstance($config);
|
||||||
self::$_driver_name = strtolower($driver_name);
|
self::$_driver_name = strtolower($driver_name);
|
||||||
|
|
|
||||||
10
common/framework/drivers/cache/dummy.php
vendored
10
common/framework/drivers/cache/dummy.php
vendored
|
|
@ -22,6 +22,16 @@ class Dummy extends File implements \Rhymix\Framework\Drivers\CacheInterface
|
||||||
*/
|
*/
|
||||||
public $data = array();
|
public $data = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override the isSupported() method of the file driver.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isSupported()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of a key.
|
* Get the value of a key.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
9
common/framework/drivers/cache/file.php
vendored
9
common/framework/drivers/cache/file.php
vendored
|
|
@ -52,15 +52,14 @@ class File implements \Rhymix\Framework\Drivers\CacheInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the current cache driver is supported on this server.
|
* Since Rhymix 2.1, This method always returns false.
|
||||||
*
|
* The file cache driver can only be used through the dummy driver.
|
||||||
* This method returns true on success and false on failure.
|
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function isSupported()
|
public static function isSupported()
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -201,6 +200,6 @@ class File implements \Rhymix\Framework\Drivers\CacheInterface
|
||||||
protected function _getFilename($key)
|
protected function _getFilename($key)
|
||||||
{
|
{
|
||||||
$hash = sha1($key);
|
$hash = sha1($key);
|
||||||
return $this->_dir . '/' . substr($hash, 0, 2) . '/' . substr($hash, 2, 2) . '/' . $hash . '.php';
|
return $this->_dir . '/' . substr($hash, 0, 2) . '/' . $hash . '.php';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue