final class ReadPreference implements Serializable, Serializable (View source)

Class ReadPreference

Constants

deprecated RP_PRIMARY

deprecated RP_PRIMARY_PREFERRED

deprecated RP_SECONDARY

deprecated RP_SECONDARY_PREFERRED

deprecated RP_NEAREST

PRIMARY Since: 1.7.0

PRIMARY_PREFERRED Since: 1.7.0

SECONDARY Since: 1.7.0

SECONDARY_PREFERRED Since: 1.7.0

NEAREST Since: 1.7.0

NO_MAX_STALENESS Since: 1.2.0

SMALLEST_MAX_STALENESS_SECONDS Since: 1.2.0

Methods

__construct(string|int $mode, array|null $tagSets = null, array|null $options = null)

Construct immutable ReadPreference

static 
__set_state(array $properties)

No description

object|null
getHedge()

Returns the ReadPreference's "hedge" option

int
getMode() deprecated

Returns the ReadPreference's "mode" option

string
getModeString()

Returns the ReadPreference's "mode" option as a string

array
getTagSets()

Returns the ReadPreference's "tagSets" option

PackedArray
bsonSerialize()

Returns an object for BSON serialization

string|null
serialize()

Serialize a ReadPreference

void
unserialize(string $data)

Unserialize a ReadPreference

getMaxStalenessSeconds()

No description

Details

final __construct(string|int $mode, array|null $tagSets = null, array|null $options = null)

Construct immutable ReadPreference

Parameters

string|int $mode
array|null $tagSets
array|null $options

Exceptions

InvalidArgumentException

static __set_state(array $properties)

No description

Parameters

array $properties

final object|null getHedge()

Since: 1.8.0

Returns the ReadPreference's "hedge" option

Return Value

object|null

final int getMode() deprecated

deprecated Use getModeString instead

Returns the ReadPreference's "mode" option

Return Value

int

final string getModeString()

Since: 1.7.0

Returns the ReadPreference's "mode" option as a string

Return Value

string

Exceptions

InvalidArgumentException

final array getTagSets()

Returns the ReadPreference's "tagSets" option

Return Value

array

final PackedArray bsonSerialize()

Since: 1.2.0

Returns an object for BSON serialization

Return Value

PackedArray

Exceptions

InvalidArgumentException

final string|null serialize()

Since: 1.7.0

Serialize a ReadPreference

Return Value

string|null

The string representation of the object or null

Exceptions

InvalidArgumentException

final void unserialize(string $data)

Since: 1.7.0

Unserialize a ReadPreference

Parameters

string $data

The string representation of the object.

Return Value

void

Exceptions

InvalidArgumentException
UnexpectedValueException

final getMaxStalenessSeconds()

No description