Identify the client via User-Agent.
This PR uses the configured API key if it exists, otherwise it generates a unique hash to identify each unique CiviCRM site.
Use caching.
This PR uses a simple SQL cache.
Notes
I came to this as lookups were failing, and I think it could have been due to the policy (1).
The caching (2) is permanent until the cache is cleared ("Cleanup caches" or such), which is probably enough.
Nominatim's usage policy says two things that we weren't doing:
Identify the client via User-Agent.
This PR uses the configured API key if it exists, otherwise it generates a unique hash to identify each unique CiviCRM site.
Use caching.
This PR uses a simple SQL cache.
Notes
I came to this as lookups were failing, and I think it could have been due to the policy (1).
The caching (2) is permanent until the cache is cleared ("Cleanup caches" or such), which is probably enough.