I'm running a Zend Framework powered website, it works great, etc.
I've the following option apc.cache-by-default
sets to on
when I check apc.php I can see a lost of file, I'm new to APC, and I'm wondering what kind of surprise could I have with this option.
I assume it is only an opcode cache of the files, then no data is cached and I won't see any difference within my 开发者_StackOverflow社区website (which needs some realtime data).
Am I right?
The next step for me is to use APC to cache some db result, but first I'd like to be sure of what a default APC configuration already does for me.
Thank you
APC's primary, out the box use is to store the code cache. It can also store data, and indeed, it's quite likely the fastest such cache as it is so closely held (in memory, and the code) to the PHP interpreter.
http://uk.php.net/manual/en/function.apc-store.php andthe matching apc_fetch have details of how to use the user/data-caching side of APC.
The only downsides are that it has limited space - no more than 32-64MB space allocations for APC's use are normal, and often as much as you would need. For large items, or more than a couple of hundred smaller variables to cache, then something like Memcached, or caching to disk, would be more useful.
The other downside is that since the cache is in memory, any variables being cached are onto a specific machine - again, something that Memcached can avoid, but at a cost of time (usually time taken over the local network).
In summary, APC is very highly recommended for the code caching (and it has save me literally billions of PHP compilation steps per week), and as a limited, but highly performant 1st-level cache of limited data cache.
精彩评论