My Rails app has to make a massive amount of external http calls. Sometimes, redundant http calls to handle a request. So, I'm looking for a way to cache external http calls. The way should use memory to keep cached data. Please help.
It seems like you could just use Rails caching to accomplish this, though I haven't actually tested it.
results = Rails.cache.fetch(cache_key) do # You could use a unique URL as part of the cache key
# HTTP request
# Return results from processing the response
end
More about Rails caching http://guides.rubyonrails.org/caching_with_rails.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With