Are SQLite database operations in Android in memory? -


i creating data repository layer in application in turn serves data 2 sources, either network api calls or getting data local storage. when there request data repository layer, first need check if data present in local storage or not. if not, make call api data. check if data in local storage or not, thinking of 2 ways implement this:

  • on app startup, load data in database memory (eg. lists, maps etc.) , whenever have check of existence of data in local storage, check memory. has possible problem have faced earlier well. when app in background, android system, might clear allocated memory serve memory other apps. makes things complicated me.
  • whenever want check existence of data in local storage, directly make queries sql tables , decide based upon that. more leaner , cleaner solution above mentioned case. worry me here performance hit. i wanted know if sqlite database runs after being loaded memory or not? if yes, memory layer of data had created above useless. if not, safe keep on querying sqlite database each , every small data request?

sqlite caches data, , android os keep database file in file cache, long there enough memory.

so when using sqlite, app's performance automatically optimized, depending on available memory.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -