2008-01-21
RailsCast89:Page Caching
关键字: page caching
# javascripts_controller.rb
caches_page :dynamic_states
# config/environments/development.rb
config.action_controller.perform_caching = true
# config/environment.rb
config.load_paths << "#{RAILS_ROOT}/app/sweepers"
# app/sweepers/state_sweeper.rb
class StateSweeper < ActionController::Caching::Sweeper
observe State
def after_save(state)
expire_cache(state)
end
def after_destroy(state)
expire_cache(state)
end
def expire_cache(state)
expire_page :controller => 'javascripts', :action => 'dynamic_states', :format => 'js'
end
end
# states_controller.rb
cache_sweeper :state_sweeper, :only => [:create, :update, :destroy]
越来越觉得看RailsCast没收货了,讲的太小儿科,学不到什么东西,内容又比较火星
关于Cache,Rails Cache这篇讲的更全面更深入
今天用t61外接公司的显示器,双显示器来用,结果经常在台式的键盘上敲半天还奇怪为什么没反应。。。
发表评论
- 浏览: 723086 次
- 性别:

- 来自: BJ

- 详细资料
搜索本博客
我的相册
screenshot
共 1 张
共 1 张
最近加入圈子
最新评论
-
Why OO sucks
看成去QQ SUCK 了
-- by xhanxhanxhan -
Rails的富文本编辑器插件 ...
有没有那个像textmate那种语法高亮的富文本编辑器?
-- by zllicho -
翻译www.djangobook.com之 ...
weiertzw 写道 1. >>> from django. ...
-- by chenjihua75 -
PHP、CakePHP哪凉快哪呆 ...
这孩子被java毒害太深。。。跳出java,你会发现外面的世界真的很大。
-- by woodless -
学习svn命令
只会用 apt-get 不是好孩子。
-- by smartly






评论排行榜