Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails-缓存外部HTTP调用_Ruby On Rails_Http_Caching - Fatal编程技术网

Ruby on rails Rails-缓存外部HTTP调用

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

我的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
  # Return results from processing the response
end

关于Rails缓存的更多信息

请查看。我认为VRC将缓存数据存储在YAML文件中。无论如何,非常感谢你!