I’m looking for a way to auto increase a value in an object atomically .
(Ex: say I have an object ‘UserObject’ and I want to increase the value ‘RunCount’ every time app launches, I do not want to fetch the object or check that value, just increase it in the background).
How could something like that be done?
Hi Elad,
To do this I would recommend the following:
Create a [url=https://backendless.com/documentation/business-logic/java/bl_custom_events.htm]custom event handler [/url](server-side code).
Inside of your custom event implementation, use the [url=https://backendless.com/documentation/utilities/rest/ut_atomic_counters_rest.htm]Atomic Counter API[/url] to increment the value and store it in UserObject.
In your app, whenever it is started, simply dispatch your custom event so it would trigger the handler from (1).
Regards,
Mark