Last updated on December 21, 2022
Zend Framework 2’s Module Manager has the ability to cache the merged configuration information for your application. The merged configuration means that all module configs and class maps over modules are merged in ZF2, in general on each request, this merging process will reduce the application performance. In order to improve ZF2 app performance we need to set The merged configuration cache.
During development this can be painful, so be sure to delete the cache file to see new changes.
Go to config/application.config.php, then add the following to the module_listener_options array
// Whether or not to enable a configuration cache.
// If enabled, the merged configuration will be cached and used in
// subsequent requests.
'config_cache_enabled' => TRUE,
// The key used to create the configuration cache file name.
'config_cache_key' => "arjun123456789",
// Whether or not to enable a module class map cache.
// If enabled, creates a module class map cache which will be used
// by in future requests, to reduce the autoloading process.
'module_map_cache_enabled' => TRUE,
// The key used to create the class map cache file name.
//'module_map_cache_key' => "arjun123456",
// The path in which to cache merged configuration.
'cache_dir' => "./data/cache",
Make the cache directory writable, if everything is fine you can able to see the cache file in the cache location