Open Plantain opened 5 years ago
It would be nice to have finer granularity control for this, down to the individual pbf. There are very real production reasons why administrators would want to focus cache allocation around certain resource intensive datasets, rather than a one-size-fits-all solution.
@ansis i'm not super familiar with the way we implemented the cache api. what are your thoughts on the feasibility of this?
I'll note that this discussion is not a new one: https://github.com/mapbox/mapbox-gl-js/pull/8363#pullrequestreview-251234313
Having control of this on a source-by-source basis would also be great - currently I already implement a cache this for my own source to allow offline/PWA capabilities.
Perhaps more useful would be instead of: mapboxgl.Map({ cacheSize: 100 1024 1024 }) but rather: map.addSource("source", {cacheSize: 100 1024 1024})
Tiles could be in an individual cache as per their source (instead of mapbox-tiles, {source}-tiles)
We could use the StorageEstimate API if available to increase the storage size.
@Plantain would love to see how you've implemented this! Currently struggling to expand the cache.
Recently a tilecache has been added to Mapbox GL JS using Cache API (https://github.com/mapbox/mapbox-gl-js/pull/8363)
The size seems to be set at 50MB, but a larger cache would improve performance on machines with more storage available. https://github.com/mapbox/mapbox-gl-js/blob/30db469efec189f100efa8ca15416f2127c267a0/src/util/tile_request_cache.js#L9
Can this be piped through to a property in mapboxgl.Map like: new mapboxgl.Map({ cacheSize: 10010241024 }) ?