Yii::app()->Cache->Delete($User_Id); Doesn’T Work!

I am going to cache “User’s Profile” page, by CFileCache using “$user_id” as key of cache.

“User’s Profile” is combination of (at least) 4 records from 4 tables.

using dependency has no performance, since it should check the ‘update_time’ fieldes of 4 records from 4 tables!

in the code, everytime the “User’s Profile” changes, I put the following code. But it doesn’t work and the (old) cached file in the runtime directory is not deleted!

 // code to update the User’sProfile here


[b][color="#483d8b"]I did the following hack too. it first generates the cached page and then will delete it.

but in my local (xammp on windows) the chached page in runtime/cache directory is not deleted with the code below.[/color][/b]

components part of config/main.php:


public function actionView($profile_id)


 $cacheId= $profile_id;

 if($this->beginCache($cacheId, array('duration'=>360000))) {





$this->endCache(); }

 Yii::app()->cache->delete($cacheId); // but it can't delete the generated cache file!


Great Thanks to @AnatolyRugalev AnatolyRugalev and @samdark

Yii::app()->cache->set($key) and Yii::app()->cache->get($key)

for Write and Read to cache,

it’s possible to delete the cached item with Yii::app()->cache->delete($key)