# Storage Transactions/Locks

**URL:** <https://forum.heroiclabs.com/t/storage-transactions-locks/4398>\
**Category:** Runtime Framework\
**Tags:** server-framework, golang, storage\
**Created:** [September 27, 2023, 9:48am UTC](https://forum.heroiclabs.com/t/storage-transactions-locks/4398 "2023-09-27T09:48:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BernardoSantos](https://avatars.discourse-cdn.com/v4/letter/b/a87d85/32.png) [@BernardoSantos](https://forum.heroiclabs.com/u/BernardoSantos)\
**Post date:** [September 27, 2023, 9:48am UTC](https://forum.heroiclabs.com/t/storage-transactions-locks/4398/1 "2023-09-27T09:48:30Z")

</div>

Hey!

Is there any type of implementation for transactions or locks on the storage?

My problem currently is, I want to read from storage to check if a bot is currently playing any match (we have user bots), if it isnt create a ticket for the bot so a real user can match with the bot.

Problem is, between reading from storage and the bot and user matching, that same bot could have been matched already.

Is there any way to implement something like this?

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [September 27, 2023, 10:04am UTC](https://forum.heroiclabs.com/t/storage-transactions-locks/4398/2 "2023-09-27T10:04:40Z")

</div>

Hello @BernardoSantos,

You should use [conditional writes](https://heroiclabs.com/docs/nakama/concepts/storage/collections/#conditional-writes) - before you create the ticket you should attempt to update the storage object holding the bot status using the `version` field from your storage read. If this fails it means that the object has since been updated, and the data you had read is outdated.

Best

---

<div class="post-metadata">

**Author:** ![BernardoSantos](https://avatars.discourse-cdn.com/v4/letter/b/a87d85/32.png) [@BernardoSantos](https://forum.heroiclabs.com/u/BernardoSantos)\
**Post date:** [September 27, 2023, 10:09am UTC](https://forum.heroiclabs.com/t/storage-transactions-locks/4398/3 "2023-09-27T10:09:16Z")

</div>

I will give it a go.
