Changeset 5177 in subversion
- Timestamp:
- Sep 5, 2011 3:58:11 PM (21 months ago)
- Location:
- trunk/roundcubemail/program/include
- Files:
-
- 2 edited
-
rcmail.php (modified) (1 diff)
-
rcube_session.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcmail.php
r5138 r5177 338 338 339 339 $this->memcache = new Memcache; 340 $mc_available = 0; 340 $this->mc_available = 0; 341 342 // add alll configured hosts to pool 343 $pconnect = $this->config->get('memcache_pconnect', true); 341 344 foreach ($this->config->get('memcache_hosts', array()) as $host) { 342 345 list($host, $port) = explode(':', $host); 343 346 if (!$port) $port = 11211; 344 // add server and attempt to connect if not already done yet 345 if ($this->memcache->addServer($host, $port) && !$mc_available) 346 $mc_available += intval($this->memcache->connect($host, $port)); 347 } 348 349 if (!$mc_available) 347 $this->mc_available += intval($this->memcache->addServer($host, $port, $pconnect, 1, 1, 15, false, array($this, 'memcache_failure'))); 348 } 349 350 // test connection and failover (will result in $this->mc_available == 0 on complete failure) 351 $this->memcache->increment('__CONNECTIONTEST__', 1); // NOP if key doesn't exist 352 353 if (!$this->mc_available) 350 354 $this->memcache = false; 351 355 } 352 356 353 357 return $this->memcache; 358 } 359 360 /** 361 * Callback for memcache failure 362 */ 363 public function memcache_failure($host, $port) 364 { 365 static $seen = array(); 366 367 // only report once 368 if (!$seen["$host:$port"]++) { 369 $this->mc_available--; 370 raise_error(array('code' => 604, 'type' => 'db', 371 'line' => __LINE__, 'file' => __FILE__, 372 'message' => "Memcache failure on host $host:$port"), 373 true, false); 374 } 354 375 } 355 376 -
trunk/roundcubemail/program/include/rcube_session.php
r5128 r5177 315 315 { 316 316 foreach ($this->gc_handlers as $fct) 317 $fct();317 call_user_func($fct); 318 318 } 319 319
Note: See TracChangeset
for help on using the changeset viewer.
