Search code examples
androidcachingoffline-caching

Best Caching method for caching news articles for offline reading


Please suggest me a caching technique where I can cache the list of items downloaded when network is on and read from cache in the absence of network. I need to have the limit for number of items stored in cache (each item avg size will be 10kb) . It will be help full if the caching technique used will handle the deleting mechanism.


Solution

  • I don't know exactly what you're storing or how much sorting you need, but if it's simple id = article to recall the basic data I'd say just use text files. Sometime simple works.

    • article121.txt
    • article1441.txt
    • ... etc

    Alternatively, in the same vein you could use JSON files

    • article121.json
    • article1441.json
    • ...etc

    Contents of JSON could contain values for title, body, etc (if needed).

    If you need to sort or search them directly I'd say SQLite probably.