[server] fix memcache functionality

Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
This commit is contained in:
DemIS-1 2024-06-20 01:26:49 +02:00 committed by Vitalii Koshura
parent d3c9bc6631
commit 1346fc7b69
No known key found for this signature in database
GPG Key ID: CE0DB1726070A5A3
1 changed files with 5 additions and 4 deletions

View File

@ -148,7 +148,7 @@ function get_cached_data($max_age, $params=""){
if ($max_age) {
if (defined('MEMCACHE_SERVERS')) {
$cache = BoincMemcache::get()->get($path);
if ($cache['content']) {
if (isset($cache['content'])) {
return $cache['content'];
} else {
return $cache;
@ -293,13 +293,14 @@ class BoincMemcache {
if (defined('MEMCACHE_PREFIX')) {
self::$instance->setOption(Memcached::OPT_PREFIX_KEY, MEMCACHE_PREFIX);
}
$server_arr = array();
$servers = explode('|', MEMCACHE_SERVERS);
foreach($servers as &$server) {
list($ip, $port) = explode(':', $server);
list($ip, $port, $weight) = explode(':', $server);
if (!$port) { $port = 11211; }
$server = array($ip, $port);
$server_arr[] = array($ip, $port, $weight);
}
self::$instance->addServers($servers);
self::$instance->addServers($server_arr);
return self::$instance;
}
}