chore(geocoder): enable caching for geocoder

This commit is contained in:
Colin Darie 2023-11-09 16:36:51 +01:00
parent 04f429abef
commit 01aaec6e90
No known key found for this signature in database
GPG key ID: 8C76CADD40253590

View file

@ -1 +1,7 @@
Geocoder.configure(lookup: :ban_data_gouv_fr, use_https: true) cache_configuration = if ENV['REDIS_CACHE_URL'].present?
{ cache: Redis.new(url: ENV['REDIS_CACHE_URL']), cache_options: { prefix: "geocoder:", expiration: 6.hours } }
else
{ cache: Geocoder::CacheStore::Generic.new(Rails.cache, { prefix: "geocoder:" }) } # generic has no specific expiration support as of geocoder 1.8
end
Geocoder.configure(lookup: :ban_data_gouv_fr, use_https: true, **cache_configuration)