fix(geocoder): ensure to use exact rails redis cache configuration

This commit is contained in:
Colin Darie 2023-11-09 18:21:38 +01:00
parent fcec4a7ef7
commit 95f61c3d97

View file

@ -1,7 +1,7 @@
cache_configuration = if ENV['REDIS_CACHE_URL'].present?
{ cache: Redis.new(url: ENV['REDIS_CACHE_URL']), cache_options: { prefix: "geocoder:", expiration: 6.hours } }
cache_configuration = if Rails.cache.respond_to?(:redis)
{ cache: Rails.cache.redis, 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
{ cache: Geocoder::CacheStore::Generic.new(Rails.cache, { prefix: "geocoder:" }) } # generic uses default Rails.cache expiration as of geocoder 1.8
end
Geocoder.configure(lookup: :ban_data_gouv_fr, use_https: true, **cache_configuration)