How to use ZendOpCache for Doctrine2 cache?

I have installed PHP 5.5.1 in my development environment and also have the configuration of Zend OpCache as a cache provider. Everything works on the server with the new version and settings, but inside my symfony 2 project I have a Doctine2 cache for storing some "static" data (countries, languages, etc.), and it does not work with Opcache.

Until today, I used the Doctrine \ Common \ Cache \ ApcCache class to work with the Doctrine2 cache using APC, but it seems that this class does not exist for working with OpCache.

This is my config.yml for the APC cache:

# Services services: cache: class: Doctrine\Common\Cache\ApcCache 

Now, using OpCache, I tried to use ZendDataCache to work with the caching system, but it does not work:

 # Services services: cache: class: Doctrine\Common\Cache\ZendDataCache 

I get this error, so I assume that the ZendDataCache class is not for OpCache:

FatalErrorException: Error: calling the undefined Doctrine \ Common \ Cache \ zend_shm_cache_fetch () function on /var/www/meediam/src/vendor/doctrine/common/lib/Doctrine/Common/Cache/ZendDataCache.php line 38

Finally, I configured ArrayCache and it works, but without a cache system.

So the question is, Does anyone know how to use Zend OpCache with Doctrine 2 cache?

PS: I am using Symfony 2.3.2

+7
php symfony doctrine2 opcache
source share
2 answers

Adding a comment as an answer.

PHP OpCache is not a full-size cache like APC. This is just a cache operation code. If you want to store user data in the same way as with the old APC, you can use Joe Watkins' APCu: https://github.com/krakjoe/apcu .

There is also yac and memcache.

+7
source share

In fact, you can use OpCache through PhpFileCache

-2
source share

All Articles