kmagua
(K Magua)
January 21, 2014, 2:06pm
1
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?
simon604
(Simonwong85)
January 23, 2014, 1:53am
3
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.
uEhlO4a
(Y Korotia)
January 25, 2014, 12:05am
5
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.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.validate_timestamps=1
opcache.revalidate_freq=2 //secs, your time,etc
opcache.save_comments=1
opcache.fast_shutdown=1
opcache.interned_strings_buffer=8
p.s.
i had to restart my computer to reset that fastcgi cache in IIS…