KarthickN
KarthickN

Reputation: 335

How to cache data in IBM Worklight?

We have developed a hybrid mobile application using IBM worklight. In our application we have used pagination. Pagination is based on the scrolling. If the user scrolls down then the next page of data will be loaded through AJAX call. I have four tabs each having different type of data which will be opened one by one if it is swiped. Consider that I'm in the 1st tab now and navigating to the 2nd tab. If I come back to 1st tab Data will be fetched again from the server. I don't want this to happen. So I want to cache the data. Is there any way to cache data in IBM worklight ? If I cache will I be able to handle the pagination also ?

Upvotes: 0

Views: 293

Answers (2)

Srinivas Sama
Srinivas Sama

Reputation: 89

Also another thing to consider is that JSONStore is not available on all the OS platforms. There are other available options such as Encrypted cache, local storage and so on.

Here is the link for comparision

http://www-01.ibm.com/support/knowledgecenter/#!/SSZH4A_6.2.0/com.ibm.worklight.dev.doc/devref/c_jsonstore_overview.html

You might want to pick up a common storage mechanism in case you might want to support a range of OS but yet have a common code base which will help out eventually in time savings developing cross platform apps.

For example for BlackBerry 10, I had to revert to common storage facility offered by HTML 5 web technologies and use that as a base. But if you plan on supporting only Android, iOS or for that matter Windows 8, then JSON store is the best way to go!

Upvotes: 1

Idan Adar
Idan Adar

Reputation: 44516

One of the features in Worklight is called JSONStore.
This feature allows you to store data locally in the device to be retrieved at any time (as well as be synced with the server and be encrypted, but those are less related here).

This way you could store related data to each of the tabs and use it when required. - JSONStore performance (search for pagination)

Upvotes: 1

Related Questions