Better Memcache

This commit is contained in:
djmaze 2021-08-23 11:52:24 +02:00
parent 8f1d96e86f
commit 8a50586d9b
2 changed files with 3 additions and 4 deletions

View file

@ -38,7 +38,7 @@ class Memcache implements \MailSo\Cache\DriverInterface
$this->iExpire = 0 < $iExpire ? $iExpire : 43200;
$this->oMem = \class_exists('Memcache',false) ? new \Memcache : new \Memcached;
if (!$this->oMem->addServer($sHost, $this->iPort))
if (!$this->oMem->addServer($sHost, \strpos($sHost, ':/') ? 0 : $this->iPort))
{
$this->oMem = null;
}

View file

@ -695,10 +695,9 @@ class Actions
case ('MEMCACHE' === $sDriver || 'MEMCACHED' === $sDriver) &&
(\class_exists('Memcache',false) || \class_exists('Memcached',false)):
$sHost = $this->Config()->Get('labs', 'fast_cache_memcache_host', '127.0.0.1');
$oDriver = new \MailSo\Cache\Drivers\Memcache(
$sHost,
strpos($sHost, ':/') ? 0 : (int)$this->Config()->Get('labs', 'fast_cache_memcache_port', 11211),
$this->Config()->Get('labs', 'fast_cache_memcache_host', '127.0.0.1'),
(int) $this->Config()->Get('labs', 'fast_cache_memcache_port', 11211),
43200,
$sKey
);