I am loading files (or rather, pictures) in my Flex application from a server, technically from a database. I display some of them at a time, think of it like an image preview, and quite often I display the same image again. But I don’t want to re-download the same file time and time again, so I would like to store it locally, and load it from there if it is available (or download it if necessary). I’m quite happy if the files can be stored in some temporary folder in AppData/iDontCare and get deleted on application restart.
File.applicationStorageDirectory would fit the bill, but only exists in Air.
What am I missing?
There’s no sense in reinventing the wheel for this, simply set up your server responses with the proper headers so the web browser can cache them. It should be fairly easy to setup server side and will require no setup client side, simply load everything again as you did the first time and it will magically come from the cache instead of your server.
Regarding cache header config, see this question or simply google a bit for something that suits your specific case better.