mapsforge/mapsforge — pull request #557 by mvglasow (2014-12-20 01:29:23+00:00)
Title: Persistent cache 2

Includes improvements discussed with Emux and Ludwig:

* Read entire cache dir when initializing a persistent cache
* Reliably enforce cache size for persistent cache (data from previous instances is now included in the count)
* Fixed NPE which occasionally occurred in FileSystemTileCache#containsKey() when persistence was enabled
* Added test case for persistent tile cache
* Added missing compatibility constructors and helper methods for apps migrating from 0.5.0
* Use file timestamp to determine age of map file
* Changed TTL to TimeToLive in identifiers
* Comment for default TTL (86400000 millis = 1 day)
* Changed default Mapnik TTL to 8279s (current OSM setting) and added comment

As mentioned before, in order to enforce cache size (and also to fix the NPE Ludwig found) I now examine the entire cache dir when the cache is initialized and enter anything I find there in the lruCache. This might affect startup performance if the cache dir holds a large number of files.