Skip to content
PHP Ecosystem
Explore

MemCacheServer

API reference › yii › caching › MemCacheServer

classyii\caching\MemCacheServer
Extendsyii\base\BaseObject
Implementsyii\base\Configurable
Since2.0
Sourceframework/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.

PropertyTypeDescriptionDefined by
$failureCallbackClosureThis callback function will run upon encountering an error. Default: null.MemCacheServer
$hoststringMemcache server hostname or IP address Default: null.MemCacheServer
$persistentboolWhether to use a persistent connection. Default: true.MemCacheServer
$portintMemcache server port Default: 11211.MemCacheServer
$retryIntervalintHow often a failed server will be retried (in seconds). Default: 15.MemCacheServer
$statusboolIf the server should be flagged as online upon a failure. Default: true.MemCacheServer
$timeoutintTimeout in milliseconds which will be used for connecting to the server. Default: 1000.MemCacheServer
$weightintProbability of using this server among all servers. Default: 1.MemCacheServer
MethodDescriptionDefined by
__construct()Constructor.yii\base\BaseObject
__call()Calls the named method which is not a class method.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() staticReturns 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
public Closure $failureCallback = null

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 bool $persistent = true

Whether to use a persistent connection.

This is used by memcache only.

public int $retryInterval = 15

How often a failed server will be retried (in seconds).

This is used by memcache only.

public bool $status = true

If the server should be flagged as online upon a failure.

This is used by memcache only.

public int $timeout = 1000

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.