Ruby on rails Rails-缓存外部HTTP调用
我的Rails应用程序必须进行大量的外部http调用。有时,为了处理请求,需要进行冗余http调用。因此,我正在寻找一种缓存外部http调用的方法。这种方法应该使用内存来保存缓存的数据。请帮助。看起来您可以使用Rails缓存来实现这一点,尽管我还没有实际测试它Ruby on rails Rails-缓存外部HTTP调用,ruby-on-rails,http,caching,Ruby On Rails,Http,Caching,我的Rails应用程序必须进行大量的外部http调用。有时,为了处理请求,需要进行冗余http调用。因此,我正在寻找一种缓存外部http调用的方法。这种方法应该使用内存来保存缓存的数据。请帮助。看起来您可以使用Rails缓存来实现这一点,尽管我还没有实际测试它 results = Rails.cache.fetch(cache_key) do # You could use a unique URL as part of the cache key # HTTP request # R
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缓存的更多信息请查看。我认为VRC将缓存数据存储在YAML文件中。无论如何,非常感谢你!