OpenLayers Caching Quota

I use OpenLayers to cache map fragments. It uses LocalStorage as a mechanism for storing cached tiles. There is an event that fires when I run out of space (i.e. 5 MB), and I have the opportunity to completely clear or repeat the cache.

I use LocalStorage to store other objects, such as settings, so its not very good if I run out of free space.

How to set maximum limit for caches cached by OpenLayers? Preferably as a size limit (not the number of elements).

+4
source share
2 answers
Good question. After reading the source code of the control, this is not possible. You will need to modify the CacheWrite class to add the maxLimit property or something like that. Another solution would be to override the entire control and use the HTML5 file API.
0
source

Use the db package to store fragments. It will remove the 5ms limit.

0
source

Source: https://habr.com/ru/post/1480962/


All Articles