How to use ZendOpCache for Doctrine2 cache?(如何将 ZendOpCache 用于 Doctrine2 缓存?)
问题描述
我已经在我的开发环境中安装了 PHP 5.5.1,并且还配置了 Zend OpCache 作为缓存提供者.一切都在使用新版本和设置的服务器上运行,但在我的 symfony 2 项目中,我有 Doctine2 缓存来存储一些静态"数据(国家、语言等),但它不适用于 Opcache.
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.
直到今天,我还在使用 DoctrineCommonCacheApcCache 使用 APC 处理 Doctrine2 缓存的类,但似乎不存在使用 OpCache 的类.
Until today, I was using the DoctrineCommonCacheApcCache class to work with the cache of Doctrine2 using APC, but seems that does not exists a class to work with OpCache.
这是我的 APC 缓存的 config.yml:
This is my config.yml for APC cache:
# Services
services:
cache:
class: DoctrineCommonCacheApcCache
现在,使用 OpCache 我尝试使用 ZendDataCache 来处理缓存系统,但不起作用:
Now, with OpCache I have tried to use ZendDataCache to deal with cache system, but does not work:
# Services
services:
cache:
class: DoctrineCommonCacheendDataCache
我收到此错误,因此我假设 ZendDataCache 类不适用于 OpCache:
I get this error, so I assume that ZendDataCache class is not for OpCache:
FatalErrorException: Error: Call to undefined function DoctrineCommonCachezend_shm_cache_fetch() in/var/www/meediam/src/vendor/doctrine/common/lib/Doctrine/Common/Cache/ZendDataCache.php line 38
FatalErrorException: Error: Call to undefined function DoctrineCommonCachezend_shm_cache_fetch() in /var/www/meediam/src/vendor/doctrine/common/lib/Doctrine/Common/Cache/ZendDataCache.php line 38
最后我配置了 ArrayCache,它可以工作,但没有缓存系统落后.
Finally I have configured the ArrayCache, and it works, but without cache system behind.
所以问题是,有人知道如何将 Zend OpCache 与 Doctrine 2 Cache 结合使用吗?
PS:我使用的是 Symfony 2.3.2
推荐答案
添加我的评论作为答案.
PHP 的 OpCache 不像 APC 那样是一个完整的缓存,它只是一个简单的操作码缓存.如果您想像使用旧 APC 一样存储自定义数据,您可以使用 Joe Watkins' APCu:https://github.com/krakjoe/apcu.
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.
还有 yac 和 memcache.
There is also yac and memcache.
这篇关于如何将 ZendOpCache 用于 Doctrine2 缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将 ZendOpCache 用于 Doctrine2 缓存?


- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- PHP - if 语句中的倒序 2021-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01