Issues

ZF-7024: Create Zend_Application_Ressource_Cache to configure Zend_Cache instances

Description

Create Zend_Application_Ressource_Cache to configure Zend_Cache instances

Comments

First ideas attached as patch

I like the idea about "shareToZendObjects' as some applications would only require one hole global cache. This option can be usefull. We could improve it by providing a way to customise the Zend classes to be given to the cache instance.

Any suggestions ?

This issue was resolved with the introduction of the cachemanager resource plugin, which will be available as of 1.10.

Will add a new Zend_Application_Resource_CacheManager issue (when it's added to the Jira list) concerning the "shareToZendObjects". Until that issue can be created, I have reopened this one so it's not lost on my radar! I will close the moment the new issue is opened.

In the meantime, I don't believe I will add the shareToZendObjects method completely as-is. It has two problems:

1) Zend_Cache_Manager is intended to allow for the lazy loading of caches. However, the method requires an upfront object on every invocation. 2) The method adds the cache to all of these components without knowing in advance which will be used. Again, forcing a per-request cache object requirement.

The cleanest resolution, I can think of right now, is to enable CacheManager support in all the OTHER resources by allowing a new configuration setting which defines the name of a cache configuration registered with the Cache Manager. The resource may then ensure the CacheManager resource is bootstrapped, and pull out the correct cache as needed if that specific resource has been used by the application. This would also allow individual resource control over what cache to use.

Nevertheless, I do see the original solution as something of a massive but simple over-attack. It should be added, and documented, as such with a detailed description of it's impact. It should also be implemented without overriding the per-resource CacheManager settings. This would allow the application of the method as a global default to cover all bases, while not preventing more specific configuration via the Cache Manager.

I'll add this in the upcoming week to Zend_Application_Resource_CacheManager in the Incubator. The other resources will need to follow suit once the class hits the trunk, but hopefully everyone will see the benefits.

Resolving given we have a CacheManager resource. If someone wants to persue a global share feature to Zend objects, it should be separately submitted (most likely for ZF 2.0).