2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-11-09 18:21:38 +01:00
|
|
|
cache_configuration = if Rails.cache.respond_to?(:redis)
|
|
|
|
{ cache: Rails.cache.redis, cache_options: { prefix: "geocoder:", expiration: 6.hours } }
|
2023-11-09 16:36:51 +01:00
|
|
|
else
|
2023-11-09 18:21:38 +01:00
|
|
|
{ cache: Geocoder::CacheStore::Generic.new(Rails.cache, { prefix: "geocoder:" }) } # generic uses default Rails.cache expiration as of geocoder 1.8
|
2023-11-09 16:36:51 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
Geocoder.configure(lookup: :ban_data_gouv_fr, use_https: true, **cache_configuration)
|