Cloud Spanner Client - Class Session (1.62.1)

Reference documentation and code samples for the Cloud Spanner Client class Session.

Represents and manages a single Cloud Spanner session.

Namespace

Google \ Cloud \ Spanner \ Session

Methods

__construct

Parameters
NameDescription
connection Google\Cloud\Spanner\Connection\ConnectionInterface

A connection to Cloud Spanner.

projectId string

The project ID.

instance string

The instance name.

database string

The database name.

name string

The session name.

info

Return info on the session.

Returns
TypeDescription
arrayAn array containing the `projectId`, `instance`, `database`, 'databaseName' and session `name` keys.

exists

Check if the session exists.

Parameter
NameDescription
options array

[optional] Configuration options.

Returns
TypeDescription
bool

delete

Delete the session.

Parameter
NameDescription
options array

[optional] Configuration options.

Returns
TypeDescription
void

name

Format the constituent parts of a session name into a fully qualified session name.

Returns
TypeDescription
string

setExpiration

Sets the expiration.

Parameter
NameDescription
expiration int

[optional] The Unix timestamp in seconds upon which the session will expire. Defaults to now plus 60 minutes.

Returns
TypeDescription
void

expiration

Gets the expiration.

Returns
TypeDescription
int|null

__debugInfo

Represent the class in a more readable and digestable fashion.