Zend_Application-AvailableResources-CacheManager.xml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect2 id="zend.application.available-resources.cachemanager">
  4. <title>Zend_Application_Resource_Cachemanager</title>
  5. <para>
  6. <classname>Zend_Application_Resource_Cachemanager</classname> may be
  7. utilised to configure a set of <classname>Zend_Cache</classname> option
  8. bundles for use when lazy loading caches using
  9. <classname>Zend_Cache_Manager</classname>
  10. </para>
  11. <para>
  12. As the Cache Manager is a lazy loading mechanism, the options are translated
  13. to option templates used to instantiate a cache object on request.
  14. </para>
  15. <example id="zend.application.available-resources.cachemanager.configExample">
  16. <title>Sample Cachemanager resource configuration</title>
  17. <para>
  18. Below is a sample <acronym>INI</acronym> file showing how
  19. <classname>Zend_Cache_Manager</classname> may be configured. The format
  20. is the Cachemanager resource prefix (<property>resources.cachemanager</property>)
  21. followed be the name to assign to an option cache template or bundle (e.g.
  22. <property>resources.cachemanager.database</property>) and finally followed by a
  23. typical <classname>Zend_Cache</classname> option.
  24. </para>
  25. <programlisting language="ini"><![CDATA[
  26. resources.cachemanager.database.frontend.name = Core
  27. resources.cachemanager.database.frontend.customFrontendNaming = false
  28. resources.cachemanager.database.frontend.options.lifetime = 7200
  29. resources.cachemanager.database.frontend.options.automatic_serialization = true
  30. resources.cachemanager.database.backend.name = File
  31. resources.cachemanager.database.backend.customBackendNaming = false
  32. resources.cachemanager.database.backend.options.cache_dir = "/path/to/cache"
  33. resources.cachemanager.database.frontendBackendAutoload = false
  34. ]]></programlisting>
  35. <para>
  36. Actually retrieving this cache from the Cache Manager is as simple as
  37. accessing an instance of the Manager and calling
  38. <command>$cacheManager->getCache('database');</command>.
  39. </para>
  40. <para>
  41. See <methodname>Zend_Cache::factory()</methodname> method to get default values
  42. description.
  43. </para>
  44. </example>
  45. </sect2>