Merge pull request #9687 from colinux/geocoder-cache
Tech: active le cache pour le geocoder pour contourner le rate limiting dans certains contextes
This commit is contained in:
commit
460d565e8c
2 changed files with 8 additions and 2 deletions
|
@ -272,7 +272,7 @@ GEM
|
||||||
et-orbi (~> 1.1, >= 1.1.8)
|
et-orbi (~> 1.1, >= 1.1.8)
|
||||||
raabro (~> 1.4)
|
raabro (~> 1.4)
|
||||||
geo_coord (0.2.0)
|
geo_coord (0.2.0)
|
||||||
geocoder (1.6.5)
|
geocoder (1.8.2)
|
||||||
globalid (1.2.1)
|
globalid (1.2.1)
|
||||||
activesupport (>= 6.1)
|
activesupport (>= 6.1)
|
||||||
gon (6.4.0)
|
gon (6.4.0)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue