PHP Class Shanty_Mongo_Connection_Group

Author: Coen Hyde
Datei anzeigen Open project: coen-hyde/shanty-mongo Class Usage Examples

Protected Properties

Property Type Description
$_masters
$_slaves

Public Methods

Method Description
__construct ( array $connectionOptions = null )
addConnections ( array $connectionOptions ) Add multiple connections at once using arrays of options
addMaster ( Shanty_Mongo_Connection $connection, integer $weight = 1 ) Add a connection to a master server
addSlave ( Shanty_Mongo_Connection $connection, $weight = 1 ) Add a connection to a slaver server
formatConnectionString ( array $connectionOptions = [] ) Format a connection string
formatHostString ( array $hostOptions = [] ) : string Format a host string
getMasters ( ) : Shanty_Mongo_Connection_Stack Get all master connections
getReadConnection ( ) : Shanty_Mongo_Connection Get a read connection
getSlaves ( ) : Shanty_Mongo_Connection_Stack Get all slave connections
getWriteConnection ( ) : Shanty_Mongo_Connection Get a write connection

Method Details

__construct() public method

public __construct ( array $connectionOptions = null )
$connectionOptions array

addConnections() public method

Add multiple connections at once using arrays of options
public addConnections ( array $connectionOptions )
$connectionOptions array

addMaster() public method

Add a connection to a master server
public addMaster ( Shanty_Mongo_Connection $connection, integer $weight = 1 )
$connection Shanty_Mongo_Connection
$weight integer

addSlave() public method

Add a connection to a slaver server
public addSlave ( Shanty_Mongo_Connection $connection, $weight = 1 )
$connection Shanty_Mongo_Connection
$weight

formatConnectionString() public method

Format a connection string
public formatConnectionString ( array $connectionOptions = [] )
$connectionOptions array

formatHostString() public method

Format a host string
public formatHostString ( array $hostOptions = [] ) : string
$hostOptions array
return string

getMasters() public method

Get all master connections
public getMasters ( ) : Shanty_Mongo_Connection_Stack
return Shanty_Mongo_Connection_Stack

getReadConnection() public method

Get a read connection
public getReadConnection ( ) : Shanty_Mongo_Connection
return Shanty_Mongo_Connection

getSlaves() public method

Get all slave connections
public getSlaves ( ) : Shanty_Mongo_Connection_Stack
return Shanty_Mongo_Connection_Stack

getWriteConnection() public method

Get a write connection
public getWriteConnection ( ) : Shanty_Mongo_Connection
return Shanty_Mongo_Connection

Property Details

$_masters protected_oe property

protected $_masters

$_slaves protected_oe property

protected $_slaves