Subscribe rss
Blog categories
All | Backendless features
Feature 61: Placing and retrieving objects from the server-side cache
March 10, 2015 by markpiller

Backendless provides a very powerful, but easy-to-use API to work with server-side cache. The API is multi-platform, it means clients written in different languages, can exchange data using the centralized server-side cache storage. The caching API can accept any arbitrary object, a primitive value or an array of object/primitive values. Additionally, the caching system can be strongly typed – a client app can specify the type which should be used to deserialize the object.

The example below places an arbitrary object into cache. The object is mapped to a name which identifies it in the context of the application. Then the object is retrieved using the same name:

Asynchronous sample (Android and Plain Java):

Synchronous sample (Plain Java only):

Synchronous sample:

Asynchronous sample:

Synchronous sample:

Asynchronous sample:

The Person class used in the example is a basic POJO. Notice it does not implement the Serializable interface (it could if you needed it to do so), nor it needs to implement any other interface:

The Caching API supports other useful features, like checking if an object exists in cache, or extending objects life in cache. These and other features will be reviewed in future posts of this blog series.

See the Backendless documentation to learn more about the Caching API.

Share this post
Tweet about this on TwitterShare on FacebookGoogle+