Ruby on Rails:清除缓存页面 [英] Ruby on Rails: Clear a cached page

查看:21
本文介绍了Ruby on Rails:清除缓存页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 RoR 应用程序(ruby v1.8.7;rails v2.3.5),它在开发环境中缓存页面.这不是什么大问题,但缓存页面的 a 元素不正确.

I have a RoR application (ruby v1.8.7; rails v2.3.5) that is caching a page in the development environment. This wouldn't be so much of an issue, but the cached page's a elements are incorrect.

我没有对 development.rb 文件进行任何更改,也没有故意向控制器添加任何缓存命令.

I haven't made any changes to the development.rb file and I haven't knowingly added any caching commands to the controllers.

我已尝试清除此站点 (localhost) 的浏览器(OSX 上的 Firefox 3.5)cookie 和页面缓存.我也重新启动了 Mongrel.似乎没有任何帮助.

I've tried clearing the browser's (Firefox 3.5 on OSX) cookie and page caches for this site (localhost). I've also restarted Mongrel. Nothing seems to help.

我错过了什么?

推荐答案

development.rb 中的这一行确保不会发生缓存.

This line in development.rb ensures that caching is not happening.

config.action_controller.perform_caching             = false

您可以使用

Rails.cache.clear

也就是说 - 我不相信这是一个缓存问题.您是否对页面进行了更改而没有看到它们的反映?您可能不是在查看该页面的实时版本?我做过一次(脸红).

That said - I am not convinced this is a caching issue. Are you making changes to the page and not seeing them reflected? You aren't perhaps looking at the live version of that page? I have done that once (blush).

更新:

您可以从控制台调用该命令.您确定您正在运行该应用程序吗?

You can call that command from in the console. Are you sure you are running the application in development?

唯一的选择是您尝试呈现的页面不是正在呈现的页面.

The only alternative is that the page that you are trying to render isn't the page that is being rendered.

如果您查看服务器输出,您应该能够在页面呈现类似于以下内容时看到渲染命令:

If you watch the server output you should be able to see the render command when the page is rendered similar to this:

Rendered shared_partials/_latest_featured_video (31.9ms)
Rendered shared_partials/_s_invite_friends (2.9ms)
Rendered layouts/_sidebar (2002.1ms)
Rendered layouts/_footer (2.8ms)
Rendered layouts/_busy_indicator (0.6ms)

这篇关于Ruby on Rails:清除缓存页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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