在Rails中缓存2.3帮助

时间:2021-02-20 03:52:47

I'm using rails 2.3 for a blog app. I'm trying to get caching to work. So far, I've managed to follow along with these tutorials: http://railslab.newrelic.com/2009/01/22/page-caching

我正在使用rails 2.3作为博客应用。我正在努力让缓存工作。到目前为止,我已经设法遵循这些教程:http://railslab.newrelic.com/2009/01/22/page-caching

I thought everything was working fine. I even managed to get a cachesweeper to work a la the next tutorial in that series.

我以为一切都很好。我甚至设法让一个cachesweeper来完成该系列的下一个教程。

But I noticed in the development log, it says the page is being cached:

但我注意到在开发日志中,它表示页面正在被缓存:

Cached page: /articles.html (0.8ms)

But when i refresh the page, development log still shows requests being made to the server. And this only happens with the index page. Requests for the show pages render the cached html. No activity in the development log. Not sure what is happening. Any help would be appreciated.

但是当我刷新页面时,开发日志仍会显示对服务器的请求。这只发生在索引页面上。显示页面的请求呈现缓存的html。开发日志中没有活动。不知道发生了什么。任何帮助,将不胜感激。

1 个解决方案

#1


0  

When you do a cache, the page is generated as an html in the respective folder. And when you do a request to the server, mongrel (web server) does capture the request made and churn it into the log, however, you'll noticed that the action, which in this case i would suppose is articles, will not be called, but the cached html page, articles.html will be rendered instead, bypassing any logic you may have.

执行缓存时,页面将在相应文件夹中生成为html。当你向服务器发出请求时,mongrel(web服务器)会捕获所做的请求并将其转换到日志中,但是,你会注意到这个动作,在这种情况下我认为是文章,不会是调用,但缓存的html页面,articles.html将被渲染,绕过你可能有的任何逻辑。

You can refer to http://railscasts.com/episodes/89-page-caching for more details =)

您可以参考http://railscasts.com/episodes/89-page-caching了解更多详情=)

#1


0  

When you do a cache, the page is generated as an html in the respective folder. And when you do a request to the server, mongrel (web server) does capture the request made and churn it into the log, however, you'll noticed that the action, which in this case i would suppose is articles, will not be called, but the cached html page, articles.html will be rendered instead, bypassing any logic you may have.

执行缓存时,页面将在相应文件夹中生成为html。当你向服务器发出请求时,mongrel(web服务器)会捕获所做的请求并将其转换到日志中,但是,你会注意到这个动作,在这种情况下我认为是文章,不会是调用,但缓存的html页面,articles.html将被渲染,绕过你可能有的任何逻辑。

You can refer to http://railscasts.com/episodes/89-page-caching for more details =)

您可以参考http://railscasts.com/episodes/89-page-caching了解更多详情=)