samedi 21 mars 2015

Should I avoid using Rails cache for geocoding data without precautions/expiration (Rails4, geocoder)

As a newbie, I'm wondering if it's OK to keep geocoding data data in Rails Cache. Indeed I'd like it to hold for 1 million users for example, and it feels like what I'm doing could allow a sort of cache-explosion:)


Here's how i do it today: I'm keeping the geocoding data I get from geocoder gem: as follows:



Geocoder.configure({
ip_lookup: :maxmind,
:maxmind => { :service => :country },
:api_key => ENV['APIKEY'],
:use_https => true,
timeout: 3,
# here it is: I use cache in order not to send every page load a request to maxmind
cache: Rails.cache
})


In that configuration, how long will Rails keep all the geocoding data in the cache? Shouldn't I set sth like an expiration on each data cached? how long?


thanks, Mathieu


Aucun commentaire:

Enregistrer un commentaire