Internal convenience method that returns the instance of the Memcache
Memcache
\RuntimeException
protected function getMemcache() {
if (null === $this->memcache) {
if (!preg_match('#^memcache://(?(?=\\[.*\\])\\[(.*)\\]|(.*)):(.*)$#', $this->dsn, $matches)) {
throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use Memcache with an invalid dsn "%s". The expected format is "memcache://[host]:port".', $this->dsn));
}
$host = $matches[1] ?: $matches[2];
$port = $matches[3];
$memcache = new Memcache();
$memcache
->addServer($host, $port);
$this->memcache = $memcache;
}
return $this->memcache;
}