Class yii\caching\MemCacheServer

Inheritanceyii\caching\MemCacheServer » yii\base\BaseObject
Implementsyii\base\Configurable
Available since version2.0
Source Code https://github.com/yiisoft/yii2/blob/master/framework/caching/MemCacheServer.php

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.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$failureCallback Closure This callback function will run upon encountering an error. yii\caching\MemCacheServer
$host string Memcache server hostname or IP address yii\caching\MemCacheServer
$persistent boolean Whether to use a persistent connection. yii\caching\MemCacheServer
$port integer Memcache server port yii\caching\MemCacheServer
$retryInterval integer How often a failed server will be retried (in seconds). yii\caching\MemCacheServer
$status boolean If the server should be flagged as online upon a failure. yii\caching\MemCacheServer
$timeout integer Timeout in milliseconds which will be used for connecting to the server. yii\caching\MemCacheServer
$weight integer Probability of using this server among all servers. yii\caching\MemCacheServer

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. yii\base\BaseObject
__construct() Constructor. yii\base\BaseObject
__get() Returns the value of an object property. yii\base\BaseObject
__isset() Checks if a property is set, i.e. defined and not null. yii\base\BaseObject
__set() Sets value of an object property. yii\base\BaseObject
__unset() Sets an object property to null. yii\base\BaseObject
canGetProperty() Returns a value indicating whether a property can be read. yii\base\BaseObject
canSetProperty() Returns a value indicating whether a property can be set. yii\base\BaseObject
className() Returns the fully qualified name of this class. yii\base\BaseObject
hasMethod() Returns a value indicating whether a method is defined. yii\base\BaseObject
hasProperty() Returns a value indicating whether a property is defined. yii\base\BaseObject
init() Initializes the object. yii\base\BaseObject

Property Details

$failureCallback public property

This 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.

public Closure $failureCallback null
$host public property

Memcache server hostname or IP address

public string $host null
$persistent public property

Whether to use a persistent connection. This is used by memcache only.

public boolean $persistent true
$port public property

Memcache server port

public integer $port 11211
$retryInterval public property

How often a failed server will be retried (in seconds). This is used by memcache only.

public integer $retryInterval 15
$status public property

If the server should be flagged as online upon a failure. This is used by memcache only.

public boolean $status true
$timeout public property

Timeout 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.

public integer $timeout 1000
$weight public property

Probability of using this server among all servers.

public integer $weight 1