lib/memcached.js
function Client (args, options) {
  // Ensure Client instantiated with 'new'
  if (!(this instanceof Client)) {
    return new Client(args, options);
  }

  var servers = []
    , weights = {}
    , regular = 'localhost:11211'
    , key;

  // Parse down the connection arguments
  switch (Object.prototype.toString.call(args)) {
    case '[object Object]':
      weights = args;
      servers = Object.keys(args);
      break;

    case '[object Array]':
      servers = args.length ? args : [regular];
      break;

    default:
      servers.push(args || regular);
      break;
  }

  if (!servers.length) {
    throw new Error('No servers where supplied in the arguments');
  }

  // merge with global and user config
  Utils.merge(this, Client.config);
  Utils.merge(this, options);

  this.servers = servers;
  var compatibility = this.compatibility || this.compatiblity;
  this.HashRing = new HashRing(args, this.algorithm, {
    'compatibility': compatibility,
    'default port': compatibility === 'ketama' ? 11211 : null
  });
  this.connections = {};
  this.issues = [];
}
function Client (args, options) {
  // Ensure Client instantiated with 'new'
  if (!(this instanceof Client)) {
    return new Client(args, options);
  }

  var servers = []
    , weights = {}
    , regular = 'localhost:11211'
    , key;

  // Parse down the connection arguments
  switch (Object.prototype.toString.call(args)) {
    case '[object Object]':
      weights = args;
      servers = Object.keys(args);
      break;

    case '[object Array]':
      servers = args.length ? args : [regular];
      break;

    default:
      servers.push(args || regular);
      break;
  }

  if (!servers.length) {
    throw new Error('No servers where supplied in the arguments');
  }

  // merge with global and user config
  Utils.merge(this, Client.config);
  Utils.merge(this, options);

  this.servers = servers;
  var compatibility = this.compatibility || this.compatiblity;
  this.HashRing = new HashRing(args, this.algorithm, {
    'compatibility': compatibility,
    'default port': compatibility === 'ketama' ? 11211 : null
  });
  this.connections = {};
  this.issues = [];
}
function Client ( args , options ) { // Ensure Client instantiated with 'new' if ( ! ( this instanceof Client ) ) { return new Client ( args , options ) ; } var servers = [ ] , weights = { } , regular = 'localhost:11211' , key ; // Parse down the connection arguments switch ( Object . prototype . toString . call ( args ) ) { case '[object Object]' : weights = args ; servers = Object . keys ( args ) ; break ; case '[object Array]' : servers = args . length ? args : [ regular ] ; break ; default : servers . push ( args || regular ) ; break ; } if ( ! servers . length ) { throw new Error ( 'No servers where supplied in the arguments' ) ; } // merge with global and user config Utils . merge ( this , Client . config ) ; Utils . merge ( this , options ) ; this . servers = servers ; var compatibility = this . compatibility || this . compatiblity ; this . HashRing = new HashRing ( args , this . algorithm , { 'compatibility' : compatibility , 'default port' : compatibility === 'ketama' ? 11211 : null } ) ; this . connections = { } ; this . issues = [ ] ; }
Constructs a new memcached client

@constructor
@param {Mixed} args Array, string or object with servers
@param {Object} options options
@api public
Constructs a new memcached client