Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/flow-flo.../libs/cakephp/cache/Engine
File: WincacheEngine.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
[2] Fix | Delete
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
[3] Fix | Delete
*
[4] Fix | Delete
* Licensed under The MIT License
[5] Fix | Delete
* For full copyright and license information, please see the LICENSE.txt
[6] Fix | Delete
* Redistributions of files must retain the above copyright notice.
[7] Fix | Delete
*
[8] Fix | Delete
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
[9] Fix | Delete
* @link https://cakephp.org CakePHP(tm) Project
[10] Fix | Delete
* @since 2.0.0
[11] Fix | Delete
* @license https://opensource.org/licenses/mit-license.php MIT License
[12] Fix | Delete
*/
[13] Fix | Delete
namespace Cake\Cache\Engine;
[14] Fix | Delete
[15] Fix | Delete
use Cake\Cache\CacheEngine;
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* Wincache storage engine for cache
[19] Fix | Delete
*
[20] Fix | Delete
* Supports wincache 1.1.0 and higher.
[21] Fix | Delete
*/
[22] Fix | Delete
class WincacheEngine extends CacheEngine
[23] Fix | Delete
{
[24] Fix | Delete
/**
[25] Fix | Delete
* Contains the compiled group names
[26] Fix | Delete
* (prefixed with the global configuration prefix)
[27] Fix | Delete
*
[28] Fix | Delete
* @var array
[29] Fix | Delete
*/
[30] Fix | Delete
protected $_compiledGroupNames = [];
[31] Fix | Delete
[32] Fix | Delete
/**
[33] Fix | Delete
* Initialize the Cache Engine
[34] Fix | Delete
*
[35] Fix | Delete
* Called automatically by the cache frontend
[36] Fix | Delete
*
[37] Fix | Delete
* @param array $config array of setting for the engine
[38] Fix | Delete
* @return bool True if the engine has been successfully initialized, false if not
[39] Fix | Delete
*/
[40] Fix | Delete
public function init(array $config = [])
[41] Fix | Delete
{
[42] Fix | Delete
if (!extension_loaded('wincache')) {
[43] Fix | Delete
return false;
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
parent::init($config);
[47] Fix | Delete
[48] Fix | Delete
return true;
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
/**
[52] Fix | Delete
* Write data for key into cache
[53] Fix | Delete
*
[54] Fix | Delete
* @param string $key Identifier for the data
[55] Fix | Delete
* @param mixed $value Data to be cached
[56] Fix | Delete
* @return bool True if the data was successfully cached, false on failure
[57] Fix | Delete
*/
[58] Fix | Delete
public function write($key, $value)
[59] Fix | Delete
{
[60] Fix | Delete
$key = $this->_key($key);
[61] Fix | Delete
$duration = $this->_config['duration'];
[62] Fix | Delete
[63] Fix | Delete
return wincache_ucache_set($key, $value, $duration);
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
/**
[67] Fix | Delete
* Read a key from the cache
[68] Fix | Delete
*
[69] Fix | Delete
* @param string $key Identifier for the data
[70] Fix | Delete
* @return mixed The cached data, or false if the data doesn't exist,
[71] Fix | Delete
* has expired, or if there was an error fetching it
[72] Fix | Delete
*/
[73] Fix | Delete
public function read($key)
[74] Fix | Delete
{
[75] Fix | Delete
$key = $this->_key($key);
[76] Fix | Delete
[77] Fix | Delete
return wincache_ucache_get($key);
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
/**
[81] Fix | Delete
* Increments the value of an integer cached key
[82] Fix | Delete
*
[83] Fix | Delete
* @param string $key Identifier for the data
[84] Fix | Delete
* @param int $offset How much to increment
[85] Fix | Delete
* @return int|false New incremented value, false otherwise
[86] Fix | Delete
*/
[87] Fix | Delete
public function increment($key, $offset = 1)
[88] Fix | Delete
{
[89] Fix | Delete
$key = $this->_key($key);
[90] Fix | Delete
[91] Fix | Delete
return wincache_ucache_inc($key, $offset);
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
/**
[95] Fix | Delete
* Decrements the value of an integer cached key
[96] Fix | Delete
*
[97] Fix | Delete
* @param string $key Identifier for the data
[98] Fix | Delete
* @param int $offset How much to subtract
[99] Fix | Delete
* @return int|false New decremented value, false otherwise
[100] Fix | Delete
*/
[101] Fix | Delete
public function decrement($key, $offset = 1)
[102] Fix | Delete
{
[103] Fix | Delete
$key = $this->_key($key);
[104] Fix | Delete
[105] Fix | Delete
return wincache_ucache_dec($key, $offset);
[106] Fix | Delete
}
[107] Fix | Delete
[108] Fix | Delete
/**
[109] Fix | Delete
* Delete a key from the cache
[110] Fix | Delete
*
[111] Fix | Delete
* @param string $key Identifier for the data
[112] Fix | Delete
* @return bool True if the value was successfully deleted, false if it didn't exist or couldn't be removed
[113] Fix | Delete
*/
[114] Fix | Delete
public function delete($key)
[115] Fix | Delete
{
[116] Fix | Delete
$key = $this->_key($key);
[117] Fix | Delete
[118] Fix | Delete
return wincache_ucache_delete($key);
[119] Fix | Delete
}
[120] Fix | Delete
[121] Fix | Delete
/**
[122] Fix | Delete
* Delete all keys from the cache. This will clear every
[123] Fix | Delete
* item in the cache matching the cache config prefix.
[124] Fix | Delete
*
[125] Fix | Delete
* @param bool $check If true, nothing will be cleared, as entries will
[126] Fix | Delete
* naturally expire in wincache..
[127] Fix | Delete
* @return bool True Returns true.
[128] Fix | Delete
*/
[129] Fix | Delete
public function clear($check)
[130] Fix | Delete
{
[131] Fix | Delete
if ($check) {
[132] Fix | Delete
return true;
[133] Fix | Delete
}
[134] Fix | Delete
$info = wincache_ucache_info();
[135] Fix | Delete
$cacheKeys = $info['ucache_entries'];
[136] Fix | Delete
unset($info);
[137] Fix | Delete
foreach ($cacheKeys as $key) {
[138] Fix | Delete
if (strpos($key['key_name'], $this->_config['prefix']) === 0) {
[139] Fix | Delete
wincache_ucache_delete($key['key_name']);
[140] Fix | Delete
}
[141] Fix | Delete
}
[142] Fix | Delete
[143] Fix | Delete
return true;
[144] Fix | Delete
}
[145] Fix | Delete
[146] Fix | Delete
/**
[147] Fix | Delete
* Returns the `group value` for each of the configured groups
[148] Fix | Delete
* If the group initial value was not found, then it initializes
[149] Fix | Delete
* the group accordingly.
[150] Fix | Delete
*
[151] Fix | Delete
* @return string[]
[152] Fix | Delete
*/
[153] Fix | Delete
public function groups()
[154] Fix | Delete
{
[155] Fix | Delete
if (empty($this->_compiledGroupNames)) {
[156] Fix | Delete
foreach ($this->_config['groups'] as $group) {
[157] Fix | Delete
$this->_compiledGroupNames[] = $this->_config['prefix'] . $group;
[158] Fix | Delete
}
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
$groups = wincache_ucache_get($this->_compiledGroupNames);
[162] Fix | Delete
if (count($groups) !== count($this->_config['groups'])) {
[163] Fix | Delete
foreach ($this->_compiledGroupNames as $group) {
[164] Fix | Delete
if (!isset($groups[$group])) {
[165] Fix | Delete
wincache_ucache_set($group, 1);
[166] Fix | Delete
$groups[$group] = 1;
[167] Fix | Delete
}
[168] Fix | Delete
}
[169] Fix | Delete
ksort($groups);
[170] Fix | Delete
}
[171] Fix | Delete
[172] Fix | Delete
$result = [];
[173] Fix | Delete
$groups = array_values($groups);
[174] Fix | Delete
foreach ($this->_config['groups'] as $i => $group) {
[175] Fix | Delete
$result[] = $group . $groups[$i];
[176] Fix | Delete
}
[177] Fix | Delete
[178] Fix | Delete
return $result;
[179] Fix | Delete
}
[180] Fix | Delete
[181] Fix | Delete
/**
[182] Fix | Delete
* Increments the group value to simulate deletion of all keys under a group
[183] Fix | Delete
* old values will remain in storage until they expire.
[184] Fix | Delete
*
[185] Fix | Delete
* @param string $group The group to clear.
[186] Fix | Delete
* @return bool success
[187] Fix | Delete
*/
[188] Fix | Delete
public function clearGroup($group)
[189] Fix | Delete
{
[190] Fix | Delete
$success = false;
[191] Fix | Delete
wincache_ucache_inc($this->_config['prefix'] . $group, 1, $success);
[192] Fix | Delete
[193] Fix | Delete
return $success;
[194] Fix | Delete
}
[195] Fix | Delete
}
[196] Fix | Delete
[197] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function