MemCacheServer
API reference › yii › caching › MemCacheServer
MemCacheServer represents the configuration data for a single memcache or memcached server.
See PHP manual for detailed explanation of each configuration property.
For more details and usage information on Cache, see the guide article on caching.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$failureCallback | Closure | This callback function will run upon encountering an error. Default: null. | MemCacheServer |
$host | string | Memcache server hostname or IP address Default: null. | MemCacheServer |
$persistent | bool | Whether to use a persistent connection. Default: true. | MemCacheServer |
$port | int | Memcache server port Default: 11211. | MemCacheServer |
$retryInterval | int | How often a failed server will be retried (in seconds). Default: 15. | MemCacheServer |
$status | bool | If the server should be flagged as online upon a failure. Default: true. | MemCacheServer |
$timeout | int | Timeout in milliseconds which will be used for connecting to the server. Default: 1000. | MemCacheServer |
$weight | int | Probability of using this server among all servers. Default: 1. | MemCacheServer |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Constructor. | yii\ |
__call() | Calls the named method which is not a class method. | yii\ |
__get() | Returns the value of an object property. | yii\ |
__isset() | Checks if a property is set, i.e. defined and not null. | yii\ |
__set() | Sets value of an object property. | yii\ |
__unset() | Sets an object property to null. | yii\ |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\ |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\ |
className() static | Returns the fully qualified name of this class. | yii\ |
hasMethod() | Returns a value indicating whether a method is defined. | yii\ |
hasProperty() | Returns a value indicating whether a property is defined. | yii\ |
init() | Initializes the object. | yii\ |
Property details
Section titled “Property details”$failureCallback
Section titled “$failureCallback ”public Closure $failureCallback = nullThis callback function will run upon encountering an error.
The callback is run before fail over is attempted. The function takes two parameters,
the $host and the $port of the failed server.
This is used by memcache only.
$persistent
Section titled “$persistent ”public bool $persistent = trueWhether to use a persistent connection.
This is used by memcache only.
$retryInterval
Section titled “$retryInterval ”public int $retryInterval = 15How often a failed server will be retried (in seconds).
This is used by memcache only.
$status
Section titled “$status ”public bool $status = trueIf the server should be flagged as online upon a failure.
This is used by memcache only.
$timeout
Section titled “$timeout ”public int $timeout = 1000Timeout in milliseconds which will be used for connecting to the server.
This is used by memcache only. For old versions of memcache that only support specifying timeout in seconds this will be rounded up to full seconds.