Browse Source

Added failureCallback, reduced timeouts to 1s

tags/2.0.0-beta
Panagiotis Moustafellos 12 years ago
parent
commit
5311dac904
  1. 2
      framework/yii/caching/MemCache.php
  2. 12
      framework/yii/caching/MemCacheServer.php

2
framework/yii/caching/MemCache.php

@ -94,7 +94,7 @@ class MemCache extends Cache
$cache->addServer($server->host, $server->port, $server->weight); $cache->addServer($server->host, $server->port, $server->weight);
} else { } else {
$cache->addServer($server->host, $server->port, $server->persistent, $cache->addServer($server->host, $server->port, $server->persistent,
$server->weight, $server->timeout, $server->retryInterval, $server->status, null, $server->timemoutms); $server->weight, $server->timeout, $server->retryInterval, $server->status, $server->failureCallback, $server->timemoutms);
} }
} }
} else { } else {

12
framework/yii/caching/MemCacheServer.php

@ -37,7 +37,7 @@ class MemCacheServer extends \yii\base\Object
/** /**
* @var integer value in seconds which will be used for connecting to the server. This is used by memcache only. * @var integer value in seconds which will be used for connecting to the server. This is used by memcache only.
*/ */
public $timeout = 2; public $timeout = 1;
/** /**
* @var integer how often a failed server will be retried (in seconds). This is used by memcache only. * @var integer how often a failed server will be retried (in seconds). This is used by memcache only.
*/ */
@ -47,8 +47,14 @@ class MemCacheServer extends \yii\base\Object
*/ */
public $status = true; public $status = true;
/** /**
* @var \Closure allows the user to specify a callback function to run upon encountering an error.
* The callback is run before failover is attempted. The function takes two parameters,
* the [[host]] and the [[port]] of the failed server.
*/
public $failureCallback = null;
/**
* @var integer value in milliseconds which will be used for connecting to the server. * @var integer value in milliseconds which will be used for connecting to the server.
* Takes precedence over timeout. This is used by memcache only. * Takes precedence over [[timeout]]. This is used by memcache only.
*/ */
public $timemoutms = 2000; public $timemoutms = 1000;
} }

Loading…
Cancel
Save