[Solved] Caching with multiple dependencies

Hello, I am reading the yii guide about data and fragment caching, and there is a really intersting part: dependencies.

It says that you can set a dependency like:

$dependency = new CDbCacheDependency('SELECT MAX(update_time) FROM tbl_post');

Letting yii cache the content until there is an higher update time so some modification have been made in the database.

I was wondering if it is possible to define severals of this dependencies.

For example, there is some sql request querying multiple table and the cache must be invalidate if the content has changed in one of those tables.

The only solution that comes to my mind to resolve this is

$dependency = new CDbCacheDependency('SELECT GREATEST(MAX(p.update_time, MAX(c.update_time)) FROM tbl_post AS p, comment AS c');

but this query is taking a lot of time so we are losing one of the interest of having cache.

So is there a solution to have multiple dependencies for one Query?

I solved my problem:

Instead of updating the update_time field only on my model, i’m also updating the update_time of my related models, so when I want to call a model I see if there was some modification in it or in a related model!