0
votes

I am new to IBM Worklight.

I implemented a simple IBM Worklight HTTP servie adapter. This adapter needs some data from server database which remains constant for all calls to this service adapter.

Fetching that data every time the adapter is called, is overhead. So I want to cache those values when the IBM Worklight server is started for first time and use them for each call to adapter.

I could not figure out how to do this? Any help greatly appreciated.

1

1 Answers

1
votes

If you're looking to do client side caching then I would suggest using JSONStore: http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v506/05_08_JSONStore_-_The_client_side_JSON_based_database_overview.pdf.

When your app starts, you can check if the data has been saved in your local storage. If it does not exist, fetch the data from the adapter and then save it locally. On each http adapter invocation, the client will have the constant data needed.

My answer is making the assumption that you need the data cached for the client to make the adapter call. If you have a worklight adapter that is getting data from another worklight adapter, then you'll need a different solution.