Permalink
Browse files

bug #27299 [Cache] memcache connect should not add duplicate entries …

…on sequential calls
  • Loading branch information...
Aleksey Prilipko authored and nicolas-grekas committed May 20, 2018
1 parent 13be093 commit af0699012ae02accb11b4b3a8d5b3fee477ceb46
@@ -45,6 +45,15 @@ public function createSimpleCache($defaultLifetime = 0)
return new MemcachedCache($client, str_replace('\\', '.', __CLASS__), $defaultLifetime);
}
public function testCreatePersistentConnectionShouldNotDupServerList()
{
$instance = MemcachedCache::createConnection('memcached://'.getenv('MEMCACHED_HOST'), array('persistent_id' => 'persistent'));
$this->assertCount(1, $instance->getServerList());
$instance = MemcachedCache::createConnection('memcached://'.getenv('MEMCACHED_HOST'), array('persistent_id' => 'persistent'));
$this->assertCount(1, $instance->getServerList());
}
public function testOptions()
{
$client = MemcachedCache::createConnection(array(), array(
@@ -169,12 +169,12 @@ public static function createConnection($servers, array $options = array())
}
if ($oldServers !== $newServers) {
// before resetting, ensure $servers is valid
$client->addServers($servers);
$client->resetServerList();
$client->addServers($servers);
}
} else {
$client->addServers($servers);
}
$client->addServers($servers);
if (null !== $username || null !== $password) {
if (!method_exists($client, 'setSaslAuthData')) {

0 comments on commit af06990

Please sign in to comment.