Skip to content
Browse files

don't readd servers when using persistent

  • Loading branch information...
1 parent 7a2312f commit 9536642820b1c8165e166e3dd352d1ef67bc1cdf @weyrick committed Feb 4, 2011
Showing with 12 additions and 7 deletions.
  1. +12 −7 lib/sessionContainers/memcached_container.inc
View
19 lib/sessionContainers/memcached_container.inc
@@ -105,14 +105,19 @@ class SM_sessionContainer_memcached extends SM_sessionContainer {
$this->ttl = $this->sessionH->directive['gcMaxLifeTime'];
global $SM_siteID;
- $this->mc = new Memcached($SM_siteID);
- if (!$this->mc->addServer($config['host'], $config['port'])) {
- $this->fatalErrorPage('unable to connect to memcached server at '.$host.':'.$port);
- }
+ $this->mc = new Memcached($SM_siteID.'_session');
+
+ // only add the servers if there aren't any, since we are using persistent connections
+ if (!count($this->mc->getServerList())) {
- $this->mc->setOption(Memcached::OPT_NO_BLOCK, true);
- $this->mc->setOption(Memcached::OPT_TCP_NODELAY, true);
- //$this->mc->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
+ if (!$this->mc->addServer($config['host'], $config['port'])) {
+ $this->fatalErrorPage('unable to connect to memcached server at '.$host.':'.$port);
+ }
+
+ $this->mc->setOption(Memcached::OPT_NO_BLOCK, true);
+ $this->mc->setOption(Memcached::OPT_TCP_NODELAY, true);
+ //$this->mc->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
+ }
}

0 comments on commit 9536642

Please sign in to comment.
Something went wrong with that request. Please try again.