Home  >  Article  >  Database  >  请教 memcached 的问题

请教 memcached 的问题

WBOY
WBOYOriginal
2016-06-07 16:31:09932browse

以前没用过memcache,最近想加一下试下,因为目前把news#index作为首页,但news基本上很少更新,有时几天才发一篇,觉得有必要缓存下。 因为news#index页面对用户没有什么不同的地方,所有考虑直接用caches_action.然后在news和comments变化的时候去expire_a

以前没用过memcache,最近想加一下试下,因为目前把news#index作为首页,但news基本上很少更新,有时几天才发一篇,觉得有必要缓存下。
因为news#index页面对用户没有什么不同的地方,所有考虑直接用caches_action.然后在news和comments变化的时候去expire_action.
但有个问题,因为用到了分页,所以加了路由
map.news_with_page '/news/page/:page', :controller => 'news', :action => 'index'
expire_action :controller => :news, :action => :index <br>
但如果我修改的是第二页的某篇news,expire_action还是只刷新了第一页的缓存。
所以请问我如何能刷新第二页的缓存?或者如何只缓存第一页?

环境:ruby1.8.7 rails2.3.14

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn