mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Remove wincache and xcache drivers - they are no longer maintained for PHP 7.2+
This commit is contained in:
parent
8234fd5c7b
commit
2437de31f3
4 changed files with 3 additions and 348 deletions
|
|
@ -51,7 +51,7 @@ class Cache
|
|||
}
|
||||
$config = isset($config['servers']) ? $config['servers'] : array();
|
||||
}
|
||||
elseif (preg_match('/^(apc|dummy|memcached?|redis|sqlite|wincache|xcache)/', strval(array_first($config)), $matches))
|
||||
elseif (preg_match('/^(apc|dummy|memcached?|redis|sqlite)/', strval(array_first($config)), $matches))
|
||||
{
|
||||
$driver_name = $matches[1] . ($matches[1] === 'memcache' ? 'd' : '');
|
||||
$class_name = '\\Rhymix\\Framework\\Drivers\\Cache\\' . $driver_name;
|
||||
|
|
|
|||
179
common/framework/drivers/cache/wincache.php
vendored
179
common/framework/drivers/cache/wincache.php
vendored
|
|
@ -1,179 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rhymix\Framework\Drivers\Cache;
|
||||
|
||||
/**
|
||||
* The WinCache cache driver.
|
||||
*/
|
||||
class WinCache implements \Rhymix\Framework\Drivers\CacheInterface
|
||||
{
|
||||
/**
|
||||
* Set this flag to false to disable cache prefixes.
|
||||
*/
|
||||
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 static function getInstance(array $config)
|
||||
{
|
||||
if (self::$_instance === null)
|
||||
{
|
||||
self::$_instance = new self();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current cache driver is supported on this server.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isSupported()
|
||||
{
|
||||
return function_exists('wincache_ucache_get');
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate cache settings.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
* @param mixed $config
|
||||
* @return bool
|
||||
*/
|
||||
public static function validateSettings($config)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of a key.
|
||||
*
|
||||
* This method returns null if the key was not found.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key)
|
||||
{
|
||||
$value = wincache_ucache_get($key, $success);
|
||||
return $success ? $value : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value to a key.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
* $ttl is measured in seconds. If it is zero, the key should not expire.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param int $ttl
|
||||
* @param bool $force
|
||||
* @return bool
|
||||
*/
|
||||
public function set($key, $value, $ttl = 0, $force = false)
|
||||
{
|
||||
return wincache_ucache_set($key, $value, $ttl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a key.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
* If the key does not exist, it should return false.
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function delete($key)
|
||||
{
|
||||
return wincache_ucache_delete($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a key exists.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function exists($key)
|
||||
{
|
||||
return wincache_ucache_exists($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Increase the value of a key by $amount.
|
||||
*
|
||||
* If the key does not exist, this method assumes that the current value is zero.
|
||||
* This method returns the new value.
|
||||
*
|
||||
* @param string $key
|
||||
* @param int $amount
|
||||
* @return int
|
||||
*/
|
||||
public function incr($key, $amount)
|
||||
{
|
||||
$result = wincache_ucache_inc($key, $amount);
|
||||
if ($result === false)
|
||||
{
|
||||
wincache_ucache_set($key, $amount);
|
||||
$result = $amount;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrease the value of a key by $amount.
|
||||
*
|
||||
* If the key does not exist, this method assumes that the current value is zero.
|
||||
* This method returns the new value.
|
||||
*
|
||||
* @param string $key
|
||||
* @param int $amount
|
||||
* @return int
|
||||
*/
|
||||
public function decr($key, $amount)
|
||||
{
|
||||
$result = wincache_ucache_dec($key, $amount);
|
||||
if ($result === false)
|
||||
{
|
||||
wincache_ucache_set($key, 0 - $amount);
|
||||
$result = 0 - $amount;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all keys from the cache.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
return wincache_ucache_clear();
|
||||
}
|
||||
}
|
||||
168
common/framework/drivers/cache/xcache.php
vendored
168
common/framework/drivers/cache/xcache.php
vendored
|
|
@ -1,168 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rhymix\Framework\Drivers\Cache;
|
||||
|
||||
/**
|
||||
* The XCache cache driver.
|
||||
*/
|
||||
class XCache implements \Rhymix\Framework\Drivers\CacheInterface
|
||||
{
|
||||
/**
|
||||
* Set this flag to false to disable cache prefixes.
|
||||
*/
|
||||
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 static function getInstance(array $config)
|
||||
{
|
||||
if (self::$_instance === null)
|
||||
{
|
||||
self::$_instance = new self();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current cache driver is supported on this server.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isSupported()
|
||||
{
|
||||
return function_exists('xcache_get');
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate cache settings.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
* @param mixed $config
|
||||
* @return bool
|
||||
*/
|
||||
public static function validateSettings($config)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of a key.
|
||||
*
|
||||
* This method returns null if the key was not found.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key)
|
||||
{
|
||||
$value = xcache_get($key);
|
||||
return $value === false ? null : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value to a key.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
* $ttl is measured in seconds. If it is zero, the key should not expire.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param int $ttl
|
||||
* @param bool $force
|
||||
* @return bool
|
||||
*/
|
||||
public function set($key, $value, $ttl = 0, $force = false)
|
||||
{
|
||||
return xcache_set($key, $value, $ttl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a key.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
* If the key does not exist, it should return false.
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function delete($key)
|
||||
{
|
||||
return xcache_unset($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a key exists.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function exists($key)
|
||||
{
|
||||
return xcache_isset($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Increase the value of a key by $amount.
|
||||
*
|
||||
* If the key does not exist, this method assumes that the current value is zero.
|
||||
* This method returns the new value.
|
||||
*
|
||||
* @param string $key
|
||||
* @param int $amount
|
||||
* @return int
|
||||
*/
|
||||
public function incr($key, $amount)
|
||||
{
|
||||
return xcache_inc($key, $amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrease the value of a key by $amount.
|
||||
*
|
||||
* If the key does not exist, this method assumes that the current value is zero.
|
||||
* This method returns the new value.
|
||||
*
|
||||
* @param string $key
|
||||
* @param int $amount
|
||||
* @return int
|
||||
*/
|
||||
public function decr($key, $amount)
|
||||
{
|
||||
return xcache_dec($key, $amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all keys from the cache.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
xcache_clear_cache(XC_TYPE_VAR);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -239,6 +239,8 @@ class Cleanup extends Base
|
|||
'classes/object/BaseObject.class.php' => 'deleted:xe',
|
||||
'classes/xml/XmlQueryParser.class.php' => 'deleted:xe',
|
||||
'classes/xml/xmlquery/' => 'deleted:xe',
|
||||
'common/framework/drivers/cache/wincache.php' => 'deleted',
|
||||
'common/framework/drivers/cache/xcache.php' => 'deleted',
|
||||
'common/img/flvplayer.swf' => 'deleted:xe',
|
||||
'common/js/jquery-1.12.4.min.js' => 'deleted',
|
||||
'common/js/jquery-1.12.4.js' => 'deleted',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue