DSNPool.
A DSNPool object stores a list of DSN objects and provide methods for weighted-random selection, failure registration, etc.
- Since
- 4.0.0
Definition at line 23 of file DSNPool.inc.
__construct |
( |
Array |
$dsn_arr | ) |
|
Constructor
- Parameters
-
array | $dsn_arr | The array of DSNs public |
Definition at line 49 of file DSNPool.inc.
Get a weighted random DSN array from the DSN pool
- Returns
- NULL|array Return a weighted random DSN array if there is still an active (non-failure) DSN object; otherwise, return NULL public
Definition at line 116 of file DSNPool.inc.
getDSNFromIndex |
( |
|
$index = -1 | ) |
|
Get DSN array from a DSN object specified by the index.
- Parameters
-
int | $index | The index to get the DSN from |
- Returns
- NULL|array Return NULL if the index is -1 or invalid; otherwise, return the DSN array of the indexed DSN object public
Definition at line 89 of file DSNPool.inc.
registerFailureDSN |
( |
|
$index = NULL | ) |
|
Register a DSN object as failure so that it will not be selected by the random selection. If no index is passed in, the current selected index will be used.
- Parameters
-
int | $index | The index of the DSN object to register as failure |
- Returns
- void public
Definition at line 67 of file DSNPool.inc.
The documentation for this class was generated from the following file:
- /Users/webmaster/Desktop/squiz_matrix/core/lib/DAL/DSNPool.inc