I am trying to implement caching on my application and have successfully enabeled APC on PHP and configured it on my YII app as highlighted here http://www.yiiframework.com/wiki/312/getting-the-most-out-of-apc-for-yii/ .
My problem is that it caches even the data from the database. I save a record, navigate away but on coming back i still get the old data.
Have i done something wrong?
Sounds like stale cache data in either data or fragment caching. Most liekely you’ve pushed it too far. Could you provide us with some code?
Are you using data caching or query caching? http://www.yiiframework.com/doc/guide/1.1/en/caching.data
Also, keep in mind that APC no longer works (well at least…) with PHP5.5 since PHP has built in opcode now. I would not recommend APC for data caching for production if you’re using PHP5.5+.
If you’re doing query caching, make sure the field in your cache dependency query is updated after you have updated your data.
That is not quite true. I wrote something regarding the situation as of v5.5 in the article linked by magua.
That’s debatable. While it works with some tricks, now seems indeed a good opportunity to make the transition to opcache+APCu or some other solution.
opcache+APCu is very stable and fast so far. in fact, this is the same stuff, only apcu is cut version of apc, it has only user data caching.
your problem was opcache which by default simply caches page w/o any checks… for ethernity.
set in php.ini
opcache.revalidate_freq=2 //secs, your time,etc
i had to restart my computer to reset that fastcgi cache in IIS…