문제

I have installed PHP 5.5.1 in my development environment, and also have config Zend OpCache as Cache provider. Everything is working on the server with the new version and settings, but inside my symfony 2 project I have the Doctine2 cache to store some "static" data (countries, languages, etc) and it not works with Opcache.

Until today, I was using the Doctrine\Common\Cache\ApcCache class to work with the cache of Doctrine2 using APC, but seems that does not exists a class to work with OpCache.

This is my config.yml for APC cache:

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

Now, with OpCache I have tried to use ZendDataCache to deal with cache system, but does not work:

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

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

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

Finally I have configured the ArrayCache, and it works, but without cache system behind.

So the question is, Anyone know how to use Zend OpCache with Doctrine 2 Cache?

PS: I am using Symfony 2.3.2

도움이 되었습니까?

해결책

Adding my comment as an answer.

PHP's OpCache is not a full blown cache as APC It is a simply opcode cache. If you want to store custom data just like you would with the old APC you can use Joe Watkins' APCu: https://github.com/krakjoe/apcu.

There is also yac and memcache.

다른 팁

You can actually use OpCache indirectly via PhpFileCache

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top