# Cloud Spanner V1 Client - Class Session (2.9.0)

2.9.0 (latest) 2.8.1 2.7.0 2.6.1 2.5.1 2.4.1 2.3.0 2.2.0 2.1.0 2.0.1-RC1 1.106.0 1.105.1 1.104.1 1.103.0 1.102.0 1.101.0 1.100.0 1.98.0 1.97.0 1.96.0 1.95.0 1.94.0 1.93.1 1.92.1 1.91.0 1.90.0 1.89.0 1.88.0 1.87.0 1.86.0 1.85.0 1.84.0 1.83.0 1.82.0 1.81.0 1.80.0 1.79.0 1.78.0 1.77.0 1.76.1 1.68.0 1.67.0 1.66.0 1.65.0 1.64.0 1.63.2 1.62.1 1.61.0 1.60.0 1.59.0 1.58.4 1.57.0 1.56.0 1.55.0 1.54.2 Reference documentation and code samples for the Cloud Spanner V1 Client class Session.

A session in the Cloud Spanner API.

Generated from protobuf message `google.spanner.v1.Session`

## Namespace

Google \\ Cloud \\ Spanner \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Output only. The name of the session. This is always system-assigned. |
| `↳ labels` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` The labels for the session. \* \* Label keys must be between 1 and 63 characters long and must conform to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. \* \* Label values must be between 0 and 63 characters long and must conform to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. \* \* No more than 64 labels can be associated with a given session. See <https://goo.gl/xmQnxf> for more information on and examples of labels. |
| `↳ create_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The timestamp when the session is created. |
| `↳ approximate_last_use_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The approximate timestamp when the session is last used. It's typically earlier than the actual last use time. |
| `↳ creator_role` | `string` The database role which created this session. |
| `↳ multiplexed` | `bool` Optional. If `true`, specifies a multiplexed session. Use a multiplexed session for multiple, concurrent operations including any combination of read-only and read-write transactions. Use [`sessions.create`](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.Client.SpannerClient#_Google_Cloud_Spanner_V1_Client_SpannerClient__createSession__) to create multiplexed sessions. Don't use [BatchCreateSessions](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.Client.SpannerClient#_Google_Cloud_Spanner_V1_Client_SpannerClient__batchCreateSessions__) to create a multiplexed session. You can't delete or list multiplexed sessions. |

### getName

Output only. The name of the session. This is always system-assigned.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Output only. The name of the session. This is always system-assigned.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLabels

The labels for the session.

- Label keys must be between 1 and 63 characters long and must conform to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.
  - Label values must be between 0 and 63 characters long and must conform to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
  - No more than 64 labels can be associated with a given session. See <https://goo.gl/xmQnxf> for more information on and examples of labels.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setLabels

The labels for the session.

- Label keys must be between 1 and 63 characters long and must conform to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.
  - Label values must be between 0 and 63 characters long and must conform to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
  - No more than 64 labels can be associated with a given session. See <https://goo.gl/xmQnxf> for more information on and examples of labels.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCreateTime

Output only. The timestamp when the session is created.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. The timestamp when the session is created.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getApproximateLastUseTime

Output only. The approximate timestamp when the session is last used. It's
typically earlier than the actual last use time.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasApproximateLastUseTime

### clearApproximateLastUseTime

### setApproximateLastUseTime

Output only. The approximate timestamp when the session is last used. It's
typically earlier than the actual last use time.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCreatorRole

The database role which created this session.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setCreatorRole

The database role which created this session.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMultiplexed

Optional. If `true`, specifies a multiplexed session. Use a multiplexed
session for multiple, concurrent operations including any combination of
read-only and read-write transactions. Use
[`sessions.create`](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.Client.SpannerClient#_Google_Cloud_Spanner_V1_Client_SpannerClient__createSession__) to create
multiplexed sessions. Don't use
[BatchCreateSessions](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.Client.SpannerClient#_Google_Cloud_Spanner_V1_Client_SpannerClient__batchCreateSessions__) to
create a multiplexed session. You can't delete or list multiplexed
sessions.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setMultiplexed

Optional. If `true`, specifies a multiplexed session. Use a multiplexed
session for multiple, concurrent operations including any combination of
read-only and read-write transactions. Use
[`sessions.create`](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.Client.SpannerClient#_Google_Cloud_Spanner_V1_Client_SpannerClient__createSession__) to create
multiplexed sessions. Don't use
[BatchCreateSessions](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.Client.SpannerClient#_Google_Cloud_Spanner_V1_Client_SpannerClient__batchCreateSessions__) to
create a multiplexed session. You can't delete or list multiplexed
sessions.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |