Search code examples
phpsymfonydoctrine-ormapcphp-5.6

Doctrine Caching - upgrading to PHP 5/6


I'm in the process of upgrading my server from PHP 5.4 to PHP 5.6. One of the performance enhancments I use is to cache Doctrine results:

$query->useResultCache('cache_key', 300);

I have Symfony configured to use APC for caching:

doctrine:
    orm:
        metadata_cache_driver: apc
        result_cache_driver: apc
        query_cache_driver: apc

In PHP 5.6, APC is removed, so I will install the APCu extension. Does the Symfony configuration need to be updated to use APCu, or will the apc cache drivers work with APCu?


Solution

  • The APCu interface is the same as it was with APC. That's why you do not need to adjust your configuration: https://github.com/krakjoe/apcu

    Edit: the namespace has changed from apc_ to apcu_ in later versions, so in order to guarantee BC they now introduced a specific wrapper: https://pecl.php.net/package/apcu_bc