final class ReadPreference implements Serializable (View source)

Class ReadPreference

Constants

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 $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

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

getMaxStalenessSeconds()

No description

Details

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

Construct immutable ReadPreference

Parameters

string $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 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 getMaxStalenessSeconds()

No description