PHP Interface Cassandra\Session

See also: Cluster::connect()
Show file Open project: datastax/php-driver Interface Usage Examples

Public Methods

Method Description
close ( float | null $timeout = null ) : void Closes current session and all of its connections.
closeAsync ( ) : cassandra\Future Asynchronously closes current session once all pending requests have finished.
execute ( cassandra\Statement $statement, ExecutionOptions $options = null ) : Rows Executes a given statement and returns a result.
executeAsync ( cassandra\Statement $statement, ExecutionOptions $options = null ) : cassandra\Future Executes a given statement and returns a future result.
metrics ( ) : array Returns current performance/diagnostic metrics.
prepare ( string $cql, ExecutionOptions $options = null ) : PreparedStatement Creates a prepared statement from a given CQL string.
prepareAsync ( string $cql, ExecutionOptions $options = null ) : cassandra\Future Asynchronously prepares a statement and returns a future prepared statement.
schema ( ) : cassandra\Schema Returns current schema.

Method Details

close() public method

Closes current session and all of its connections.
public close ( float | null $timeout = null ) : void
$timeout float | null Timeout to wait for closure in seconds
return void

closeAsync() public method

Asynchronously closes current session once all pending requests have finished.
public closeAsync ( ) : cassandra\Future
return cassandra\Future future

execute() public method

Executes a given statement and returns a result.
public execute ( cassandra\Statement $statement, ExecutionOptions $options = null ) : Rows
$statement cassandra\Statement statement to be executed
$options ExecutionOptions execution options (optional)
return Rows execution result

executeAsync() public method

Note that this method ignores timeout specified in the ExecutionOptions, you can provide one to Future::get() instead.
public executeAsync ( cassandra\Statement $statement, ExecutionOptions $options = null ) : cassandra\Future
$statement cassandra\Statement statement to be executed
$options ExecutionOptions execution options (optional)
return cassandra\Future future result

metrics() public method

Returns current performance/diagnostic metrics.
public metrics ( ) : array
return array Performance/Diagnostic metrics.

prepare() public method

Note that this method only uses the ExecutionOptions::$timeout option, all other options will be ignored.
public prepare ( string $cql, ExecutionOptions $options = null ) : PreparedStatement
$cql string CQL statement string
$options ExecutionOptions execution options (optional)
return PreparedStatement prepared statement

prepareAsync() public method

Note that all options passed to this method will be ignored.
public prepareAsync ( string $cql, ExecutionOptions $options = null ) : cassandra\Future
$cql string CQL string to be prepared
$options ExecutionOptions preparation options
return cassandra\Future statement

schema() public method

NOTE: the returned Schema instance will not be updated as the actual schema changes, instead an updated instance should be requested by calling Session::schema() again.
public schema ( ) : cassandra\Schema
return cassandra\Schema current schema.