Opt*_*mus 9 memcached caching zend-framework doctrine-orm
假设我有一个被调用的Product实体,每次用户点击产品信息页面时都会加载该实体.通常我会将对象保存在Zend_Cache(memcache)中一小时,以避免为每个请求命中数据库,但据我所知,由于Proxy对象,Doctrine2实体无法实现.
所以我的问题是,如何避免为每个请求从数据库中加载相同的实体?
[编辑]
我试过像这样使用Doctrine Cache
Run Code Online (Sandbox Code Playgroud)$categoryService = App_Service_Container::getService('\App\Service\Category'); $cache = $categoryService->getEm()->getConfiguration()->getResultCacheImpl(); $apple = $cache->fetch('apple');
但是我收到以下错误
警告:require(App/Entity/Proxy/_ CG _ /App/Entity/Category.php)[function.require]:无法打开流:/ opt/vhosts/app/price/library /中没有此类文件或目录第163行的Doctrine/Common/ClassLoader.php
这与Zend Cache相同,并且由于Proxy类,您无法序列化实体