Page Caching with CFileCache

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?

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…