Zend_Application_Resource_Cachemanager
Zend_Application_Resource_Cachemanager may be
utilised to configure a set of Zend_Cache option
bundles for use when lazy loading caches using
Zend_Cache_Manager
As the Cache Manager is a lazy loading mechanism, the options are translated
to option templates used to instantiate a cache object on request.
Sample Cachemanager resource configuration
Below is a sample INI file showing how
Zend_Cache_Manager may be configured. The format
is the Cachemanager resource prefix (resources.cachemanager)
followed be the name to assign to an option cache template or bundle (e.g.
resources.cachemanager.database) and finally followed by a
typical Zend_Cache option.
Actually retrieving this cache from the Cache Manager is as simple as
accessing an instance of the Manager (Zend_Cache_Manager)
retrieved from Zend_Application_Resource_Cachemanager and
calling Zend_Cache_Manager::getCache('database'). The example
below is taken from a controller where the bootstrap class can be accessed as
a Front Controller parameter (which is automatically assigned during bootstrapping).
As you can see, the Cache Manager Resource implements a
getCacheManager() method to retrieve the bootstrapped instance
of Zend_Cache_Manager.
getFrontController()
->getParam('bootstrap')
->getPluginResource('cachemanager')
->getCacheManager();
$dbCache = $manager->getCache('database');
]]>
See Zend_Cache::factory() method to get a
description of the default values you can assign when configuring a
cache via a configuration file such as out example INI file above.