3
我正在寻找缓存以及如何在Doctrine中使用它。Zend Framework - Doctrine2 - 知识库查询缓存
我有我的Zend框架的bootstrap.php如下:我用我的数据库运行一个非常简单的查询
// Build Configuration
$orm_config = new \Doctrine\ORM\Configuration();
// Caching
$cacheOptions = $options['cache']['backendOptions'];
$cache = new \Doctrine\Common\Cache\MemcacheCache();
$memcache = new Memcache;
$memcache->connect($cacheOptions['servers']['host'], $cacheOptions['servers']['port']);
$cache->setMemcache($memcache);
$orm_config->setMetadataCacheImpl($cache);
$orm_config->setQueryCacheImpl($cache);
$orm_config->setResultCacheImpl($cache);
:
self::_instance()->_em->getRepository('UserManagement\Users')->find('1');
而且我不确定如果我正确使用缓存,因为使用它(如上面配置中的 ),查询似乎需要两倍的时间才能执行 ,因为它被禁用,是吗?
由于提前, 史蒂夫