+6
Planned

Option to purge unused cached map tiles

magma1447 6 years ago updated by GCDroid Support 6 months ago 9

I really love that GCDroid caches map tiles. I currently have over 3 GB of map tiles cached in my phone, which is quite a lot.

The downside is of course the size of the data. I would suggest saving a timestamp of when each tile was last used, and an option to (automatically, or manually) remove tiles not accessed in X days. I figure X would be useful as anything between 30 and 500 days.

Under review

yeah I like that idea :-) And I think I already have a timestamp.

Let's say 90 days sounds reasonable? Or 60?

Guess anything beyond that means you're not using the data and it can be purged.

There are many places I don't visit that often, but still like to have (data-)cached, not the least because there are worse LTE coverage than normal. If I had the option to set the number of days in Settings, I would probably set it to 200-500 somewhere to be honest. But I don't really have issues with storage in my phone either, probably worse for some others.

+2

Well once implemented, why not make it an option to set the days :-) Problem solved...

You could even consider to have that setting per Tileserver. Not sure it's useful, but something to consider for a few minutes. :)

Planned

yes, that is where I would add it anyways since I store a bunch of server specifics already. easy to add caching time.

Love the idea.  As time has progressed for me storage on my phone has become cheaper and more abundant.  It has been a long time since I ran out of storage on my phone. I remember those days. They were not fun.


As this is 5 years old, is it still as important an issue? 

Yeah, I know.... I still want to limit the overall cache size somehow. No need to cache 10GB of old tiles.

Plus, let's assume the server provider updated the maps. If I find the tiles in the cache, I will not load it from the server, so the user would not see the updated maps.

Of course, that is the whole point of the cache ;-) But I think I still should evict items over a certain age and/or size.

Are the tile servers using the HTTP headers "correctly" to help you manage this? Its been a while since I looked at http headers but there were expires and cache-control and other headers.  Are those honored?   


One of my fears is getting someplace with no offline maps and the cache does not save me.

+1

@sloth96 It works differently here. So those headers would not matter. I am thinking along the lines of:

- limit total cache size per map to X GB (X in the range of 2 GB maybe, but could be user option, including unlimited)

- track usage of tiles and the first tiles to go are the ones used the longest ago.

- delete all tiles not used in X days (I was thinking 365 days, maybe also user option, including keep forever)

GCDroid looks in its internal cache and if the tile is present then there is never any network traffic at all. So not the usual HTTP cache.