Message:

Subscribe rss
Blog categories
All | Backendless features
Feature 62: Support for cross-platform, multi-type atomic counters
March 11, 2015 by markpiller
Spread the love

There are plenty of use cases when mBaaS-powered applications must use centralized mechanism for incrementing or decrementing a value.There are several approaches for maintaining a counter – some apps use a database, others keep it in the server-side business logic.

Backendless offers a specialized API for working with atomic counters. The API is cross-platform – any number of different clients (including REST) can work with the same counter and update it concurrently. Every counter in Backendless has a name, which is assigned by the client application. The sample below demonstrates the API for incrementing and retrieving the value of a counter.

Asynchronous sample (Android and Plain Java):

Synchronous sample (Plain Java only):

Asynchronous sample:

Synchronous sample:

Asynchronous sample:

The API is very easy to use and provides several other features like decrementing a value, performing a conditional update, retrieving current value and resetting a counter.

Share this post
Tweet about this on TwitterShare on FacebookGoogle+