A very noob question here.
I just installed APC and when I go to the monitoring page (apc.php) and click on the “System Cache Entries” tab I can see a lot of pages on that list after browsing my app that’s hosted on the server. To test I restarted apache and all the cache entries were gone but as soon as I started browsing more pages on my app again they started appearing on that list.
I didn’t make any changes to my code, so is this all I have to do to enable optcode caching? Or are changes to my code also necessary?
I ask because my app is using codeigniter and there is a page in the codeigniter docs on caching docs that describes code changes:
APC stores opcode caches as they are parsed. As you have already discovered the caches only persist as long as apache remains open. But when an opcode cache is missing for a page that is requested, APC will store it for as long as Apache remains running. However, opcode caches are only half the battle. While it is true you will receive a speed increase from caching opcode, a lot of time in PHP is lost to file input/output and socket communications (ie. database queries). As long as you can be sure that your script is the only resource which will be modifying the database or a file, you can safely caching database query results or file contents so that each request doesn’t need to touch the filesystem or database layer. The logic for this uses some APC functions:
The only disadvantage to this solution is if you need to modify any cached resource outside of the PHP script, you will need to clear the APC cache from the CLI.