I am saving MapTiles to my internal cache which I retrieve using getCacheDir()
. I have a few questions regarding the handling of the cache size.
- How should I go about setting a maximum size for my cache directory before I start handling the deletion of files? With the newer devices a large cache isn't so much of a problem as there is quite a bit of space (not limitless but a fair amount), however the older devices have quite small internal memory and therefore cache sizes are going to be more important...
- At the moment, I store a tile's use count and last used timestamp so I know which tiles I can delete and which not to delete. This way I can see which are used and which aren't, allowing me to remove the less used tiles. What happens when the Android OS decides it needs space and delete my cache? Is there an Intent I can listen for that tells me which files in my application's cache were deleted?