There are several tutorials on how to implement custom AsyncTaskLoaders but none I found discusses how to handle data caching - in all of them the data are just loaded and delivered.
Can you give me some hints how to implement custom AsyncTaskLoader that would return cached versions of data immediatelly but at the same time request an update of the data and deliver the updated vesions of them as soon as they arrive? Is this even possible with Loaders or do I have to use another mechanism and which?
Background: I have an IntentService which accepts requests for data loading and delivers the results in broadcasts. I have an UI (ListView) that should display that data from ArrayAdapter or CrusorAdapter. I need some "caching" layer that would keep lastest known versions of the data to be displayed immediatelly but issue their update and re-display them as soon as new data arrives.
Although this could be done using dumb SQLite database for immediate versions and broadcast receiver for new data update, I'd give a preference to something that would make this "backgorund" data loading mechanism transparent like Loader-derived class IMHO could be.