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');
而且我不確定如果我正確使用緩存,因爲使用它(如上面配置中的 ),查詢似乎需要兩倍的時間才能執行 ,因爲它被禁用,是嗎?
由於提前, 史蒂夫