M
M
MaxUp2012-12-13 16:56:06
Google
MaxUp, 2012-12-13 16:56:06

What are the strategies for caching Google Map requests?

There is a server that uses google map and generates a fairly large number of requests to Google Maps (routs and geocoding). I would like to reduce this number by proxying requests to the server. What is the best way to proxy such requests? In what form to store? It looks simple enough at first glance, but maybe someone already got into pitfalls during development? Advise best practice.

Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SkyCat, 2012-12-13
@SkyCat

Cache geocoder responses in the database for a day, say. We cache almost all answers from Yandex.maps.

P
Pavel Tyslyatsky, 2012-12-13
@tbicr

Direct geocoding is simple: there is an address, there is a result in the form of coordinates - this can be stored in caches for a very long time, perhaps even in the database.
The reverse is a little tricky, since the coordinates may still be slightly different, but if the coordinates basically do not change, then you can also cache effectively. If the coordinates are slightly different, then you can round up, for example, up to 10 meters ±, the result should not suffer much (you can test it).
With routes, the situation is similar, those for addresses as with direct geocoding, for coordinates as with reverse geocoding.
Any key-value storage is suitable for the cache, in particular memcached and the like, depending on the amount of data and the cache space. Store as a request-response, in principle, at any level of processing, the main thing is that you can create a unique key (hash) and deserialize the resulting object. Storage time is a matter of taste, it is unlikely that this data will change often, and if it does, it is unlikely to change significantly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question