inconsistent fragment cache

Hi all,

I want to (file)cache a fragment of my main layout. It’s working fine, no db queries are made, except that the content of the cached portion seems to vary across several pages. I haven’t set any varyBy… properties, yet still it happens. Even if I set

varyByExpression => "Yii::app()->user->checkAccess('admin')"

, both admin pages and non-admin pages vary across pages. I just don’t get it. Could anyone throw some light on this please?

FYI, there are a couple of renderPartials within the cached portion, but I assume this shouldn’t make any difference?

I fixed this by setting ‘varyByRoute’ to false, which seems to be set to true by default. Hope this helps anyone facing the same problem!