Open
Description
Hello 👋
I've encountered an issue when using Geocoder::CacheStore::Generic.new(Rails.cache, {})
and passing an expiration in the cache_options. The @cache_hit
is always true (after the first request). I expected @cache_hit
to return false one the first request after the cache expired.
Upon reviewing the implementation here, it appears that expires_in is never passed to Rails.cache, which handles expiration logic.
I came across a related issue, but it focuses mainly on updating the documentation. Would it be possible to implement a proper Geocoder::CacheStore::RailsCache
? This would eliminate the need for users to extend or monkey patch the gem.
For context, here is my configuration:
Geocoder.configure(
timeout: 3, # geocoding service timeout (secs)
lookup: :nominatim,
language: :de, # ISO-639 language code
use_https: true, # use HTTPS for lookup requests? (if supported)
cache: Geocoder::CacheStore::Generic.new(Rails.cache, {}),
cache_options: {
expiration: 2.seconds
},
units: :km, # :km for kilometers or :mi for miles
)
I am happy to work on a PR!
Thank you for considering this! 😊
Metadata
Metadata
Assignees
Labels
No labels