“预热缓存"部署时 [英] "Warm Up Cache" on deployment

查看:15
本文介绍了“预热缓存"部署时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人有任何插件或 capistrano 配方,可以通过在部署时或在部署发生之前在本地构建所有页面缓存的 html 来预热"rails 应用程序的页面缓存.

I am wondering if anyone has any plugins or capistrano recipes that will "pre-heat" the page cache for a rails app by building all of the page cached html at the time the deployment is made, or locally before deployment happens.

我有一些几乎没有变化的静态网站,如果 html 已经写好,运行速度会更快,而不是需要一个访问者点击网站.

I have some mostly static sites that do not change much, and would run faster if the html was already written, instead of requiring one visitor to hit the site.

它是否已经存在,而不是自己创建(看起来很容易但它的优先级较低)?

Rather than create this myself (seems easy but it lowwwww priority) does it already exist?

推荐答案

我已经设置了集成测试,以确认站点的所有主要区域都可用(总共几百页).他们不会做任何改变数据的事情——只是拉回页面和表单.

I have set integration tests that confirm all of the main areas of the site are available (a few hundred pages in total). They don't do anything that changes data - just pull back the pages and forms.

我目前在部署生产实例时不会运行它们,但现在您提到了它 - 这实际上可能是一个好主意.

I don't currently run them when I deploy my production instance, but now you mention it - it may actually be a good idea.

另一种选择是拉取站点地图中出现的每个页面(如果您有,您可能应该这样做).编写一个执行此操作的 gem/rake 脚本应该很容易.

Another alternative would be to pull every page that appears in your sitemap (if you have one, which you probably should). It should be really easy to write a gem / rake script that does that.

这篇关于“预热缓存"部署时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆