Yii Framework Forum: Page Caching with CFileCache - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Page Caching with CFileCache Rate Topic: -----

#1 User is offline   edwaa 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 17-May 09
  • Location:Seattle, WA

Posted 03 March 2010 - 01:11 AM

I've successfully implemented page caching in my application. Now I'm trying to customize it a bit further. I only have "view" pages cached. However, when the content of these view pages changes, I want to flush cache just after content is updated in the database such that when the view is accessed again it will show the new content. How do I flush the cache for a given route + params?
0

#2 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,016
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 03 March 2010 - 03:35 AM

You can check the sources for COutputCache::getCacheKey. But seems like key calculation is very complex. Even though i see the advantage of your approach i think, it's hard to implement that with the way Yii's caching works now. You should better use a CDbCacheDependency instead, at the cost of an additional query for each page request.

Another workaround could be, that you use CExpressionDependency and call your own method inside that expression. That method could then use a custom approach (e.g. use data caching to save an array of unchanged pages) to find out, wether content from DB has changed. When you change a DB value, you need to remove that page id from your list. Just brainstorming...
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users