How to cache and store objects and set an expire policy in android?
        Posted  
        
            by virsir
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by virsir
        
        
        
        Published on 2010-05-03T02:02:39Z
        Indexed on 
            2010/05/03
            2:08 UTC
        
        
        Read the original article
        Hit count: 395
        
I have an app fetch data from internet, for better performance and bandwidth, I need to implement a cache layer.
There are two different data coming from the internet, one is changing every one hour and another one does not change basically. So for the first type of data, I need to implement an expire policy to make it self deleted after it was created for 1 hour, and when user request that data, I will check the storage first and then goto internet if nothing found.
I thought about using a SharedPrefrence or SQLDatabase to store the json data or serialized object string.
My question is:
1) What should I use, SharedPrefrence or SQLDatabase or anything else, a piece of data is not big but there are maybe many instances of that data.
2) How to implement that expire system.
© Stack Overflow or respective owner