Positive locking is a method to guarantee that the client-side product that you are upgrading (or erasing) is the exact same as the product in DynamoDB. Positive concurrency depends upon inspecting a worth upon conserve to guarantee that it has actually not altered. If you utilize this method, then your database composes are safeguarded from being overwritten by the composes of others– and vice-versa.
By default, the DynamoDB compose operations ( PutItem
, UpdateItem
, DeleteItem
) are genuine: each of these operations will overwrite an existing product that has actually the defined main secret.
DynamoDB additionally supports conditional composes for these operations. A conditional compose will prosper just if the product associates fulfill several anticipated conditions. Otherwise, it returns a mistake. Conditional composes are valuable in numerous scenarios. For instance, you may desire a PutItem
operation to prosper just if there is not currently a product with the exact same main secret. Or you might avoid an UpdateItem
operation from customizing a product if among its qualities has a specific worth. Conditional composes are valuable in cases where numerous users try to customize the exact same product.
In the AWS SDK for PHP, there is a PessimisticLockingStrategy
class for DynamoDB. This locking method utilizes cynical locking (comparable to how the native PHP session handler works) to guarantee that sessions are not modified while another procedure is reading/writing to it. Cynical locking can be costly and can increase latencies, particularly in cases where the user can access the session more than as soon as at the exact same time (e.g. ajax, iframes, or numerous web browser tabs).