I have a Yii (1.1.14) application that uses CMemCache for caching.
I am consistently having a problem with Yii "ignoring" cache dependencies and loading the old, obsolete data from the cache.
Code sample:
$dependency = new CDbCacheDependency('SELECT MAX(GREATEST(created, modified)) FROM brand');
$model = Brand::model()->cache(3600 * 24, $dependency)->find(array(
'condition' => "REPLACE(name, ' ', '-') LIKE :id",
'params' => array(
':id' => $id
)
));
I have confirmed that even when the result of the dependency query changes (I ran the query in phpMyAdmin before and after modifying the record), the cache is not refreshed.
I am having this problem consistently throughout the application. The tables in question are InnoDB tables (MySQL) if that makes a difference