perliedman / leaflet-control-geocoder

A simple geocoder form to locate places. Easily extended to multiple data providers.
http://www.liedman.net/leaflet-control-geocoder/
BSD 2-Clause "Simplified" License
564 stars 221 forks source link

Ability to cache request in sessionStorage #318

Open SuperPat45 opened 3 years ago

SuperPat45 commented 3 years ago

It will be awesome if we could have an option to cache results of geocode / reverse in sessionStorage to save duplicated requests in case the user refresh the page.

simon04 commented 3 years ago

I wonder whether a generic solution for this request is possible/desirable. In addition to the default network request cache of the browser, there are various technologies such as Session Storage, Local Storage, Indexed DB, Cache Storage. How to decide when to expire/revalidate a cached result? How to decide when to purge a cached result?

A possible way of implementing this feature would be to setup a proxy geocoder similar to the existing latlng: https://github.com/perliedman/leaflet-control-geocoder/blob/master/src/geocoders/latlng.ts

I will most likely not work on this feature request myself.