Best practices for retrieving datas

Hello all,

I am going forward with Backendless and I love it.
I have a question regarding the data retrieving. Not deeply related to Backendless, but still.
I used to call the API on each page I need to fill my tableViews (I need companies from Bar category, I’ll make an find() API call with a WHERE clause to get only the Bars).
If a user goes back to the previous page to get another category, it will recall the API with another WHERE clause. It doesn’t take a long time to get the records, but a user could get bored to have to wait few seconds every time he looks for a list.

I didn’t figure out since now because I was using the local persistence provided by the BaaS. But now I am wondering what would be the best practice to improve it…

#1. getting all the records and update them during a launchScreen, store them in a local storage, and fetch from the local storage? (could be long to get all the records in one call…).
#2. Everytime the user calls a category, store or update the records in the local storage?
#3. Do nothing and keep calling the API every time.
#4. I am missing something way much better than that ;0)

Thanks

Vincent

Hi Vincent,

I think caching the results you already retrieved would be the best option. Either local cache (fastest, but required more code) or the server-side cache (faster, but very little extra code).

The latter option can be implemented with the following APIs:
https://backendless.com/documentation/utilities/android/ut_caching_api_android.htm

Hope this helps.

Regards,
Mark

Hi Mark,

Thanks for your answer.
Could you please at least give me enough time to refresh my browser before replying? :smiley: :smiley: :smiley: :smiley:

I will call Flash from now on ;0)

Thanks a lot it is really a great pleasure to feel such a support during work. Next time I’ll travel to TX I’ll definitely pass by with some french stuffs ;0)

:slight_smile: You’re welcome to visit us here any time!

Hi,

I had a look to the cache options. I think it won’t be suitable for what I want to do because I may have a lot of records to keep.
Furthermore I would like to provide an offline service when there is no network.

I am currently having a look to implement a Realm solution + Backendless API. We’ll see where it brings me!