PHP’s APC – Don’t back yourself into a corner

We heavily rely on running multiple instances of code where I work. At any given time several of us have several copies/branches of the site code configured to run from various spots on our development server.

A path we have gone down with APC’s user variable caching is merely one of convenience for the most part. There’s only one resource that comes to mind that requires caching.

At any rate, testing things in a multiple instance environment is prone to collisions. Much to my dismay, I find the APC configuration options lacking:

– Can’t set a global prefix – This could be wildly useful for shared hosts and for our scenario, set a global prefix and transparently prepend.

– Can’t turn entire thing off – You can’t turn APC off via .htaccess/ini_set() (forcing things to draw ‘fresh’ every time)

In a nutshell, start smart by generating a global prefix and being diligent with the prefix for your codebase. (Or, perhaps wrap APC to make this easier). It will pay off someday, I’m just glad we aren’t in too deep to quickly rewire it all.

Leave a Reply

Your email address will not be published. Required fields are marked *