plz i need some help here , i've goolged a lot but without result :/ how can i exploit the query and their result stored in the memcache , i'm working with zend framework 2 and doctrine 2 ? and here is my configuration in module.config.php :
// Doctrine config
'doctrine' => array(
'driver' => array(
__NAMESPACE__ . '_driver' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity')
),
'orm_default' => array(
'drivers' => array(
__NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver'
),
)
),
/***** enabling the memcache ****/
'configuration' => array(
'orm_default' => array(
'metadata_cache' => 'mycache',
'query_cache' => 'mycache',
'result_cache' => 'mycache',
)
/**** end ****/
)
),
'service_manager' => array(
'factories' => array(
'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
'navigation' => 'Zend\Navigation\Service\DefaultNavigationFactory',
'doctrine.cache.mycache' => function ($sm) {
$cache = new \Doctrine\Common\Cache\MemcacheCache();
$memcache = new \Memcache();
$memcache->connect('localhost', 11211);
$cache->setMemcache($memcache);
return $cache;
},
),
),
any idea or link is appeciated , thanks. Regards.
I suppose You are using DoctrineModule, right? Change your configuration to this:
How does this work?
In module configuration are predefined configurations for every supported cache adapter, including memcache. With this configuration, you are saying "use memcache for caching":
This cache needs configured Memcache instance and this config saying "Memcache instance is available in ServiceManager with key 'doctrine.cache.mycache'"
Update:
How to use result cache (documentation):