Lock concept for clouddb or other Databases

Hello experts,

In my app I use some lists (for example: name, points, date) and save them in a Redis CloudDB. So far everything works.
StoreValue, GetValue sometimes take a little longer. If several users access the CloudDB at the same time, there are problems. How can I ensure that access to the database only works when it is not in use?

My idea:
TAG: Database_locked = false or true.

How can I solve that when you click on the “save” button the application waits until the value under Database_locked = true?

Does anyone have a better solution?

For example

  1. The application is currently closed even though it has not yet saved everything in the CloudDb. -> It should only close the screen when everything is saved: While loop?

  2. It should only start saving when no other user is currently saving. What can I insert? (Wait until database unlocked?)

Some reading for you:

Having multiple users “shouldn’t” be an issue on a redis server

Thanks Tim,

writing at the same time is not the problem either. But I read the value of a ‘tag’ -> change it and save it again.

I want to prevent others from changing in parallel during the change. So I don’t need a technical lock but rather a technical one ?!

other Example:

If I continue working immediately after Get_Value, the list is still empty, because he is probably faster at SET Global_index than he has filled the Name list.

Hence, I need the logic in got_Value
:frowning:

Is there a way that it doesn’t run Set Global index until the data is read and the lists are filled? (not Empty)