NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

# Class AbstractLockingStrategy

Base class for session locking strategies. Includes write and delete logic

  Aws\DynamoDb\Session\LockingStrategy\AbstractLockingStrategy implements Aws\DynamoDb\Session\LockingStrategy\LockingStrategyInterface

### Direct known subclasses

`Aws\DynamoDb\Session\LockingStrategy\NullLockingStrategy`, `Aws\DynamoDb\Session\LockingStrategy\PessimisticLockingStrategy`

Abstract
Namespace: Aws\DynamoDb\Session\LockingStrategy
Located at Aws/DynamoDb/Session/LockingStrategy/AbstractLockingStrategy.php

## Methods summary

- `public` `__construct ( Aws\DynamoDb\DynamoDbClient $client, Aws\DynamoDb\Session\SessionHandlerConfig $config )`
- `public` `doWrite ( string $id, string $data, bool $isDataChanged )`

  Writes the session data to Dynamo DB

- `public` `doDestroy ( string $id )`

  Deletes a session record from Dynamo DB

- `protected` `formatKey ( string $keyValue )`

  Generates the correct key structure based on the key value and DynamoDB API version

- `abstract protected` `getExtraAttributes ( )`

  Allows the specific strategy to add additional attributes to update

## Methods detail

# `public`
`__construct( `Aws\DynamoDb\DynamoDbClient` $client, `Aws\DynamoDb\Session\SessionHandlerConfig` $config )`

#### Parameters

$client
  ``Aws\DynamoDb\DynamoDbClient``
  $client The DynamoDB client
$config
  ``Aws\DynamoDb\Session\SessionHandlerConfig``
  $config The session handler config options

# `public boolean`
`doWrite( string $id, string $data, boolean $isDataChanged )`

Writes the session data to Dynamo DB

#### Parameters

$id
  `string`
  $id The session ID
$data
  `string`
  $data The serialized session data
$isDataChanged
  `boolean`
  $isDataChanged Whether or not the data has changed

#### Returns

`boolean`

#### Implementation of

`Aws\DynamoDb\Session\LockingStrategy\LockingStrategyInterface::doWrite()`
# `public boolean`
`doDestroy( string $id )`

Deletes a session record from Dynamo DB

#### Parameters

$id
  `string`
  $id The session ID

#### Returns

`boolean`

#### Implementation of

`Aws\DynamoDb\Session\LockingStrategy\LockingStrategyInterface::doDestroy()`
# `protected array`
`formatKey( string $keyValue )`

Generates the correct key structure based on the key value and DynamoDB API version

#### Parameters

$keyValue
  `string`
  $keyValue The value of the key (i.e., the session ID)

#### Returns

`array`
formatted key structure
# `abstract protected array`
`getExtraAttributes( )`

Allows the specific strategy to add additional attributes to update

#### Returns

`array`

### Methods inherited from Aws\DynamoDb\Session\LockingStrategy\LockingStrategyInterface

`doRead()`

### Magic methods summary

## Properties summary

`protected `Aws\DynamoDb\DynamoDbClient`` | $client | # The DynamoDB client
`protected `Aws\DynamoDb\Session\SessionHandlerConfig`` | $config | # The session handler config options