Caching JSON Data With LRUCache

45 sec read

Dear Developer Welcome.

Good to see you back.

Today we gonna learn how to increase Average revenue per user (ARPU) by decreasing GPRS data connection usage by a mobile application.

Kudos to your intelligence in determining that data caching is the way that save app user from loading data from server again n again.

Considering the diagram below that gives an overview of whole process.


Algorithm :
A fancy term for unambiguous steps.

1. At first a network request is made and desired data is fetched from server. 
2. Data fetched from network , it is parsed by our state of art JSON parser and the result is then saved to a Object.
3. Object is then added to arraylist.
4. ArrayList is added to the cache (LRUcache in Android) as key value pair entry . 
5. Now next time whenever HTTP request for data is to be made first LRU cache is searched. if there is a data , UI Shows it from there. if no data, again Step 1 is done.

Simple right! I knew it.

Algorithm steps are quite generic , concrete implementations for android platform or ios platform may differ.

Note : Dear Copy-Paste Community :).
Hope you are doing good.
If you are a software engineer study the material before copy pasting.

Else knowledge gets increased when it is shared.