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.
问问题
1816 次
1 回答
9
似乎您可以使用 Rails 缓存来完成此操作,尽管我还没有实际测试过它。
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
有关 Rails 缓存的更多信息http://guides.rubyonrails.org/caching_with_rails.html
于 2013-06-14T14:57:14.900 回答