Allow connection to Memcached and Redis via unix socket

This commit is contained in:
Kijin Sung 2017-09-11 17:33:19 +09:00
parent 363f2feeac
commit 1042479d5b
4 changed files with 93 additions and 34 deletions

View file

@ -45,10 +45,17 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
foreach ($config as $url)
{
$info = parse_url($url);
if (isset($info['host']) && isset($info['port']))
if (starts_with('/', $url))
{
$this->_conn->addServer($info['host'], $info['port']);
$this->_conn->addServer($url, 0);
}
else
{
$info = parse_url($url);
if (isset($info['host']) && isset($info['port']))
{
$this->_conn->addServer($info['host'], $info['port']);
}
}
}
}
@ -107,10 +114,17 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
foreach ($config as $url)
{
$info = parse_url($url);
if (isset($info['host']) && isset($info['port']))
if (starts_with('/', $url))
{
$conn->addServer($info['host'], $info['port']);
$conn->addServer($url, 0);
}
else
{
$info = parse_url($url);
if (isset($info['host']) && isset($info['port']))
{
$conn->addServer($info['host'], $info['port']);
}
}
}