gregallensworth / L.TileLayer.Cordova

Leaflet TileLayer subclass which caches to local filesystem, for Cordova/Phonegap
MIT License
87 stars 25 forks source link

getDiskUsage() won't count only my own tiles #5

Closed gregallensworth closed 9 years ago

gregallensworth commented 9 years ago

getDiskUsage() would count up all files in the folder, not necessarily filtering by the filename matching the L.TileLayer's name option. As such, two L.TileLayer.Cordova instances which share the same folder but have distinct name options would have their usage "blended together"

This may have implications for Issue #1 (ability to delete tiles) if this same code is used to calculate what tiles to delete: deletion of one layer's tiles may in fact delete them for all layers.

This may be a feature if we document and expect that all tiles sharing the same folder option will share the same usage pool and deletion pool. I've been thinking about the need for a "L.TileLayer.Cordova.Manager" to handle multiple L.TileLayer.Cordova instances and tally up their disk usage, delete them all, etc. This current behavior may be exactly what we want, if it's made clear that getDiskUsage() operates on a folder and not a specific layer

gregallensworth commented 9 years ago

Per the documentation, ability to use "folder" to separate layers into storage pools (or not) is pretty cool, so let's keep it as long as it's well documented.