Cachearium\Backend\CacheMemcached::addServers PHP Method

addServers() public method

public addServers ( array $servers ) : boolean
$servers array Each entry in servers is supposed to be an array containing hostname, port, and, optionally, weight of the server. $servers = array( array('mem1.domain.com', 11211, 33), array('mem2.domain.com', 11211, 67) );
return boolean
    public function addServers($servers)
    {
        if (!self::hasMemcachedExt()) {
            return false;
        }
        return $this->memcached->addServers($servers);
    }

Usage Example

 /**
  * Cache constructor (this is a singleton).
  *
  * @param $serves optional. If present, addServers() is called with this parameter
  * but only if the singleton is being created for the first time.
  * @return Cache The cache singleton.
  * @codeCoverageIgnore
  */
 public static function singleton($servers = [])
 {
     static $instances;
     if (!isset($instances)) {
         $instances = new CacheMemcached();
         if (count($servers)) {
             $instances->addServers($servers);
         }
     }
     return $instances;
 }