Lock dynamic data store

Vote:
 

Hello,

I would like to know if it is possible to lock dynamic data store avoiding that several threads could access the same store at the same time.

My idea is to implement a counter and stores its value using DDS. Every time I create a block of type T, I increment the counter. The problem is that if I create two blocks at the same time, the counter would increase only 1, instead of 2 units.

Kind regards,

Jesus.

#183280
Edited, Oct 10, 2017 12:49
Vote:
 

One approach is to define a repository that takes care of the updates towards DDS. Then if you scope your repository as Singleton in the IOC container you can have your own lock handling within your repository. 

#183298
Oct 10, 2017 20:05
Vote:
 

Thats all good until you run on more than one server.  I guess you could write a lock to Redis but isn't this a feature that should be part of the API?  Afterall in the API you can use transactions.

#183310
Oct 11, 2017 9:04
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.