openstreetmap / mod_tile

Renders map tiles with mapnik and serves them using apache
http://wiki.openstreetmap.org/wiki/Mod_tile
GNU General Public License v2.0
288 stars 191 forks source link

Limit total size of cached tiles #223

Open trohsb opened 3 years ago

trohsb commented 3 years ago

Is it possible to limit the total size of cached files to say 512MB and then delete tiles based on last accessed timestamps when space is needed?

SomeoneElseOSM commented 3 years ago

@trohsb If you're trying to do something like that, https://github.com/SomeoneElseOSM/mod_tile/blob/zoom/purge_old_tiles.sh might be a useful example to start from. See also https://github.com/SomeoneElseOSM/mod_tile/blob/zoom/report_tile_size.sh and https://github.com/SomeoneElseOSM/mod_tile/blob/zoom/report_database_size.sh . Each of those may need modifying to match your tile location. database location and mod_tile version of course.

pantierra commented 3 years ago

There are so many useful scripts around mod_tile. Wondering if at some point it would make sense to put them all together in a helper program with command-line arguments :thinking:

pantierra commented 3 years ago

For now, @SomeoneElseOSM, do you think it would make sense to add these scripts to the utils directory and make them available here?

SomeoneElseOSM commented 3 years ago

do you think it would make sense to add these scripts to the utils directory and make them available here?

Yes - but you'd ned to make sure that https://github.com/SomeoneElseOSM/mod_tile/blob/zoom/purge_old_tiles.sh was using the standard mod_tiles's "long time ago" (20 years) as opposed to mine (10k days, which I chose because it's more visible when you're looking at dates on disk)