Browse Source

Added failureCallback, reduced timeouts to 1s

tags/2.0.0-beta
Panagiotis Moustafellos 11 years ago
parent
commit
5311dac904
  1. 2
      framework/yii/caching/MemCache.php
  2. 16
      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);
} else {
$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 {

16
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.
*/
public $timeout = 2;
public $timeout = 1;
/**
* @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;
/**
* @var integer value in milliseconds which will be used for connecting to the server.
* Takes precedence over timeout. This is used by memcache only.
*/
public $timemoutms = 2000;
* @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.
* Takes precedence over [[timeout]]. This is used by memcache only.
*/
public $timemoutms = 1000;
}

Loading…
Cancel
Save