PHP 5.5 includes zend opcache by default, which basically means that almost nobody will use APC.
But what to use instead of the user data cache part of APC (apc_store & apc_fetch & similar)?
One use case where I really like to use APC user data cache are "versions" of static assets (javascript, css..). Whenever I reference static file, I add hash of its content into the url (e.g. <script src=/script.js> will became <script src=/script.js?v=hash>), so that browser always uses current version and can cache it permanently.
I can imagine using redis or memcache to store the hashes of static files, but it seems silly to ask another process over network or socket just to get a hash of file content. APC user data cache (which is in shared memory and accessing it is almost as fast as accesing php variable) seems just the right thing to use for such data.
So the question is: what to use in php 5.5 to cache small bits of data instead of APC?
Starting from PHP 5.5 the APC user data storage is packaged separately as PECL APCu.
brew install php55-apcu
) apt-get install php5-apcu
)yum install php-pecl-apcu
)This allows you to use all user cache functions, such as apc_store(). It will also return true
for extension_loaded('apc')
- this means that all libraries depending on APC will work similarly to PHP 5.4.