ruby-on-rails - 如果静态图像是从亚马逊的 S3 云服务器加载的,它们是否会被 Heroku 缓存?

标签 ruby-on-rails heroku

标题几乎描述了我的整个问题。 因为现在我想知道通过将我的静态图像上传到 heroku 或亚马逊的 s3,我的应用程序是否更快。

最佳答案

根据 Heroku 开发中心,Aspen 和 Bamboo 堆栈上的 Heroku 应用程序使用 Varnish缓存应用程序的输出。在 Cedar 堆栈上,必须使用 rack-cache 和 memcache 附加组件。如果您使用的是 Aspen 或 Bamboo,这里有更多信息:

来自Heroku Dev Center :

Anything that is served from the filesystem (a Rack::File) is cached for 12 hours. Whenever you push changes, your cache is cleared (see below), and since Heroku filesystems are read-only, it’s safe to cache these for a long period.

然而他们在旁边提到:

Large static assets, such as MP3s or PDFs, should generally not be included in your code tree. Use an external asset hosting service such as Amazon S3, instead. See this article for more information.

关于ruby-on-rails - 如果静态图像是从亚马逊的 S3 云服务器加载的,它们是否会被 Heroku 缓存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8639594/

相关文章:

ruby-on-rails - Rails 新命令不起作用

ruby-on-rails - 如何使用searchkick设置word_middle区分大小写的搜索?

ruby-on-rails - 在 Ruby on Rails 中将字符串转换为两字节十六进制 unicode

ruby-on-rails - 无法让 PostGIS 与 Heroku/Rails 一起使用 - NoMethodError : undefined method `geography' / 'st_point'

ruby-on-rails - Heroku 无法转储匿名类

javascript - 我无法在 Heroku 中运行我的 ReactJS 应用程序

ruby-on-rails - RAILS_ENV 更改 app/layouts/application.html.erb 内容

mysql - 我如何使用 Rails 中的 SQL 代码对此进行编码?

ruby-on-rails - 为 Heroku 域指定 SSL 端点

ruby-on-rails - Heroku登录时出现 ruby 错误