caching - ZF2 Doctrine2 Entity Cache -
does know how cache doctrine2 entities in zf2 project. cant find tutorial or website explained. cant find information start defining entity filecache.
somebody of got working links or examples.
thanks
you have 2 options
- use doctrine's native caching, e.g. using memcache (in memcache block can use kind of doctrine supported cache, full list of cache drivers available).
- use doctrine's adapter zend/cache/storage use cache you're using elsewhere; adapter described in doctrinemodule docs.
as example of version two, have following configuration in module (actually spread across various config files, can't guarantee copy-pasting verbatim work).
'services' => array( 'factories' => array( // wraps zf2 cache storage in doctrine compatible way 'doctrine.cache.zend.static.local' => function ($services) { return new zendstoragecache($services->get('cache.static.local')); }, ), 'caches' => array( // zf2 cache, can configured 'cache.static.local' => array( 'adapter' => 'xcache', 'plugins' => array( 'exception_handler' => array( 'throw_exceptions' => false, ), 'serializer', ), ), ), 'doctrine' => array( 'configuration' => array( 'orm_default' => array( 'metadata_cache' => 'zend.static.local', 'query_cache' => 'zend.static.local', ), ), ),
note doctrine annoyingly automatically prefixes "doctrine.cache." name of cache service configure, while configure "metadata_cache" "zend.static.local", actual cache service must named "doctrine.cache.zend.static.local". can call them want, you'll need add prefix whatever call them.
Comments
Post a Comment