PHP Class Cassandra\Cluster\Builder

See also: Cassandra::cluster()
Afficher le fichier Open project: datastax/php-driver Class Usage Examples

Méthodes publiques

Méthode Description
build ( ) : Cassandra\Cluster Returns a Cluster Instance.
withConnectTimeout ( float $timeout ) : Builder Timeout used for establishing TCP connections.
withConnectionsPerHost ( integer $core = 1, integer $max = 2 ) : Builder Set the size of connection pools used by the driver. Pools are fixed when only $core is given, when a $max is specified as well, additional connections will be created automatically based on current load until the maximum number of connection has been reached. When request load goes down, extra connections are automatically cleaned up until only the core number of connections is left.
withContactPoints ( $host ) : Builder Configures the initial endpoints. Note that the driver will automatically discover and connect to the rest of the cluster.
withCredentials ( string $username, string $password ) : Builder Configures cassandra authentication.
withDatacenterAwareRoundRobinLoadBalancingPolicy ( string $localDatacenter, integer $hostPerRemoteDatacenter, boolean $useRemoteDatacenterForLocalConsistencies ) : Builder Configures this cluster to use a datacenter aware round robin load balancing policy.
withDefaultConsistency ( integer $consistency ) : Builder Configures default consistency for all requests.
withDefaultPageSize ( integer | null $pageSize ) : Builder Configures default page size for all results.
withDefaultTimeout ( float | null $timeout ) : Builder Configures default timeout for future resolution in blocking operations Set to null to disable (default).
withIOThreads ( integer $count ) : Builder Total number of IO threads to use for handling the requests.
withLatencyAwareRouting ( boolean $enabled = true ) : Builder Enables/disables latency-aware routing.
withPersistentSessions ( boolean $enabled = true ) : Builder Enable persistent sessions and clusters.
withPort ( integer $port ) : Builder Specify a different port to be used when connecting to the cluster.
withProtocolVersion ( integer $version ) : Builder Force the driver to use a specific binary protocol version.
withReconnectInterval ( float $interval ) : Builder Specify interval in seconds that the driver should wait before attempting to re-establish a closed connection.
withRequestTimeout ( float $timeout ) : Builder Timeout used for waiting for a response from a node.
withRetryPolicy ( RetryPolicy $policy ) : Builder Configures the retry policy.
withRoundRobinLoadBalancingPolicy ( ) : Builder Configures this cluster to use a round robin load balancing policy.
withSSL ( Cassandra\SSLOptions $options ) : Builder Set up ssl context.
withSchemaMetadata ( boolean $enable = true ) : Builder Enables/disables Schema Metadata.
withTCPKeepalive ( float | null $delay ) : Builder Enables/disables TCP keepalive.
withTCPNodelay ( boolean $enabled = true ) : Builder Disables nagle algorithm for lower latency.
withTimestampGenerator ( Cassandra\TimestampGenerator $generator ) : Builder Sets the timestamp generator.
withTokenAwareRouting ( boolean $enabled = true ) : Builder Enable token aware routing.

Method Details

build() public méthode

Returns a Cluster Instance.
public build ( ) : Cassandra\Cluster
Résultat Cassandra\Cluster Cluster instance

withConnectTimeout() public méthode

Timeout used for establishing TCP connections.
public withConnectTimeout ( float $timeout ) : Builder
$timeout float Timeout value in seconds, can be fractional
Résultat Builder self

withConnectionsPerHost() public méthode

Set the size of connection pools used by the driver. Pools are fixed when only $core is given, when a $max is specified as well, additional connections will be created automatically based on current load until the maximum number of connection has been reached. When request load goes down, extra connections are automatically cleaned up until only the core number of connections is left.
public withConnectionsPerHost ( integer $core = 1, integer $max = 2 ) : Builder
$core integer minimum connections to keep open to any given host
$max integer maximum connections to keep open to any given host
Résultat Builder self

withContactPoints() public méthode

Configures the initial endpoints. Note that the driver will automatically discover and connect to the rest of the cluster.
public withContactPoints ( $host ) : Builder
Résultat Builder self

withCredentials() public méthode

Configures cassandra authentication.
public withCredentials ( string $username, string $password ) : Builder
$username string Username
$password string Password
Résultat Builder self

withDatacenterAwareRoundRobinLoadBalancingPolicy() public méthode

Configures this cluster to use a datacenter aware round robin load balancing policy.
public withDatacenterAwareRoundRobinLoadBalancingPolicy ( string $localDatacenter, integer $hostPerRemoteDatacenter, boolean $useRemoteDatacenterForLocalConsistencies ) : Builder
$localDatacenter string Name of the local datacenter
$hostPerRemoteDatacenter integer Maximum number of hosts to try in remote datacenters
$useRemoteDatacenterForLocalConsistencies boolean Allow using hosts from remote datacenters to execute statements with local consistencies
Résultat Builder self

withDefaultConsistency() public méthode

Configures default consistency for all requests.
public withDefaultConsistency ( integer $consistency ) : Builder
$consistency integer A consistency level, must be one of Cassandra::CONSISTENCY_* values
Résultat Builder self

withDefaultPageSize() public méthode

Set to null to disable paging altogether.
public withDefaultPageSize ( integer | null $pageSize ) : Builder
$pageSize integer | null default page size
Résultat Builder self

withDefaultTimeout() public méthode

Configures default timeout for future resolution in blocking operations Set to null to disable (default).
public withDefaultTimeout ( float | null $timeout ) : Builder
$timeout float | null Timeout value in seconds, can be fractional
Résultat Builder self

withIOThreads() public méthode

Note: number of io threads * core connections per host <= total number of connections <= number of io threads * max connections per host
public withIOThreads ( integer $count ) : Builder
$count integer total number of threads.
Résultat Builder self

withLatencyAwareRouting() public méthode

Enables/disables latency-aware routing.
public withLatencyAwareRouting ( boolean $enabled = true ) : Builder
$enabled boolean whether to actually enable or disable the routing.
Résultat Builder self

withPersistentSessions() public méthode

Enable persistent sessions and clusters.
public withPersistentSessions ( boolean $enabled = true ) : Builder
$enabled boolean whether to enable persistent sessions and clusters (optional)
Résultat Builder self

withPort() public méthode

Specify a different port to be used when connecting to the cluster.
public withPort ( integer $port ) : Builder
$port integer a number between 1 and 65535
Résultat Builder self

withProtocolVersion() public méthode

Apache Cassandra 1.2+ supports protocol version 1 Apache Cassandra 2.0+ supports protocol version 2 Apache Cassandra 2.1+ supports protocol version 3 Apache Cassandra 2.2+ supports protocol version 4 NOTE: Apache Cassandra 3.x supports protocol version 3 and 4 only
public withProtocolVersion ( integer $version ) : Builder
$version integer the actual protocol version, only `1`, `2`, `3`, or `4` are supported
Résultat Builder self

withReconnectInterval() public méthode

Specify interval in seconds that the driver should wait before attempting to re-establish a closed connection.
public withReconnectInterval ( float $interval ) : Builder
$interval float interval in seconds
Résultat Builder self

withRequestTimeout() public méthode

Timeout used for waiting for a response from a node.
public withRequestTimeout ( float $timeout ) : Builder
$timeout float Timeout value in seconds, can be fractional
Résultat Builder self

withRetryPolicy() public méthode

Configures the retry policy.
public withRetryPolicy ( RetryPolicy $policy ) : Builder
$policy RetryPolicy the retry policy to use.
Résultat Builder self

withRoundRobinLoadBalancingPolicy() public méthode

Configures this cluster to use a round robin load balancing policy.
public withRoundRobinLoadBalancingPolicy ( ) : Builder
Résultat Builder self

withSSL() public méthode

Set up ssl context.
public withSSL ( Cassandra\SSLOptions $options ) : Builder
$options Cassandra\SSLOptions a preconfigured ssl context
Résultat Builder self

withSchemaMetadata() public méthode

If disabled this allows the driver to skip over retrieving and updating schema metadata, but it also disables the usage of token-aware routing and $session->schema() will always return an empty object. This can be useful for reducing the startup overhead of short-lived sessions.
public withSchemaMetadata ( boolean $enable = true ) : Builder
$enable boolean whether the driver fetches and maintains schema metadata.
Résultat Builder self

withTCPKeepalive() public méthode

Enables/disables TCP keepalive.
public withTCPKeepalive ( float | null $delay ) : Builder
$delay float | null the period of inactivity in seconds, after which the keepalive probe should be sent over the connection. If set to `null`, disables keepalive probing.
Résultat Builder self

withTCPNodelay() public méthode

Disables nagle algorithm for lower latency.
public withTCPNodelay ( boolean $enabled = true ) : Builder
$enabled boolean whether to actually enable or disable nodelay.
Résultat Builder self

withTimestampGenerator() public méthode

Sets the timestamp generator.
public withTimestampGenerator ( Cassandra\TimestampGenerator $generator ) : Builder
$generator Cassandra\TimestampGenerator A timestamp generator that will be used to generate timestamps for statements.
Résultat Builder self

withTokenAwareRouting() public méthode

Enable token aware routing.
public withTokenAwareRouting ( boolean $enabled = true ) : Builder
$enabled boolean Whether to enable token aware routing (optional)
Résultat Builder self