Zend Framework: Zend_Cache_Backend_Compression Component Proposal
| Proposed Component Name | Zend_Cache_Backend_Compression |
|---|---|
| Developer Notes | http://framework.zend.com/wiki/display/ZFDEV/Zend_Cache_Backend_Compression |
| Proposers | Maxime Varinard |
| Zend Liaison | TBD |
| Revision | 1.0 - 23 Juil 2009: Initial Draft. (wiki revision: 9) |
Table of Contents
1. Overview
Zend_Cache_Backend_Compression will add some compress features to "Output" Zend_Cache. This tool will help to compress and obfuscate javascript output dynamically generated.
Next features can be to compress html and css.
2. References
3. Component Requirements, Constraints, and Acceptance Criteria
- This component will purpose different compress tools (Jsmin, Yui and Dean Edwards JavaScript's Packer). Their job is to compress and obfuscate. This component won't compress and obfuscate because some opensource and very good tools already exist.
- This component will use a file to store data.
- This component will manage an output only.
4. Dependencies on Other Framework Components
- Zend_Cache
- External javascript compressor library : Jsmin, Yui and Dean Edwards JavaScript's Packer (putted into asset dir)
5. Theory of Operation
The component is instantiated when you'll call a Zend_Cache_Backend.
6. Milestones / Tasks
Describe some intermediate state of this component in terms of design notes, additional material added to this page, and / code. Note any significant dependencies here, such as, "Milestone #3 can not be completed until feature Foo has been added to ZF component XYZ." Milestones will be required for acceptance of future proposals. They are not hard, and many times you will only need to think of the first three below.
- Milestone 1: [DONE]First real tests see files here http://framework.zend.com/issues/secure/attachment/11853/ZF-issue.zip
- Milestone 2: Integrate community feedback
- Milestone 3: Write unit test
If a milestone is already done, begin the description with "[DONE]", like this:
- Milestone #: [DONE] Unit tests ...
7. Class Index
- Zend_Cache_Compression
- Zend_Cache_Backend_Compressor_Default
- Zend_Cache_Backend_Compressor_Interface
- Zend_Cache_Backend_Compressor_Jsmin
- Zend_Cache_Backend_Compressor_Yui
8. Use Cases
| UC-01 |
|---|
This is create cache
| UC-02 |
|---|
This is the way to compress CSS
| UC-03 |
|---|
This is the way to compress javascript
10 Comments
comments.show.hideJul 28, 2009
Matthew Weier O'Phinney
This proposal needs a lot more information:
I'm returning this proposal to "New" status. Please get community review prior to requesting recommendation again; I know there are a number of community members who may have opinions on the design and functionality.
Aug 20, 2009
Maxime
I completed this proposal. Code is ready for community alpha testing.
I'm waiting your feedback.
Aug 20, 2009
Matthew Weier O'Phinney
Maxime: the process is quite clear: you need to ask for community review first, and then mark it as ready for recommendation. I've moved it back to "Ready for Review", which is the area for community review. Please post an email to fw-general and/or zf-contributors asking for feedback on the proposal before you mark it as ready for recommendation again.
I have some feedback as well. First, thank you for updating the use cases and code skeletons. However, I still have questions:
Aug 21, 2009
Luiz Fernando Furtado
It's better to have a component that do js/css compression, and optionaly use Zend_Cache to optimum performance, like Zend_Db_Table store a table description in Zend_Cache, but we don't have Zend_Cache_Db_Table to do this.
Other thing that we don't need to know internal storage of Zend_Cache backends, and you are proposing to use a Zend_Cache struture do to a compression, store a data and to retrieve a diferent data (compressed or minified), I think that cache it's to store and retrieve the same data.
On the other hand, a Zend_Cache_Compression to store some big data to save disk space it's more acceptable, but the compression will slow don't the application.
Integration with Zend_View to automatic join / compress / minifie js and css files are welcome, but it's a hard job to do this, specialy with css.
Aug 22, 2009
Thomas Weidner
In my understanding a Cache backend is used internally to store in a wished data structure.
What ever I enter within a cache, I will get the same data when I retrieve it.
It is not intended to get files which can be used external like JS or related.
When I want to compress JS files I would use Zend_Compress / Zend_Filter_Compress / Zend_View or related.
-1 from my side... Zend_Cache is the wrong place for such a feature. I would understand when you want to compress/decompress Cache files but this would only apply to a very small amount of Backends as all binary backends (APC, Memcached) are already compressed.
Aug 26, 2009
Maxime
Thanks for your feedback.
You've right, Zend_Compress should be better. I'll update this wiki page and rename Zend_Cache_Backend_Compress to Zend_Compress.
Aug 26, 2009
Maxime
Thanks for your feedback.
You've right, Zend_Compress should be better. I'll update this wiki page and rename Zend_Cache_Backend_Compress to Zend_Compress.
I'll ask to Steven Brown to help him here : http://framework.zend.com/wiki/display/ZFPROP/Zend_Compress+Proposal+-+Steven+Brown
Jul 22, 2010
Nick Daugherty
I have a fully working set of filter components that perform minification on css, javascript, and html. You can see them under the 'ready for review' section of the wiki. I think this proposal would best serve the framework by being refactored as a view helper component that can optionally use existing cache backends for storing the processed output. We should strive to keep caching and minification separate as appropriate to promote the quality and reusability of the zend framework.
Jul 22, 2010
Maxime
Great stuff
I'll check your proposal.
Feb 08, 2011
Dolf Schimmel (Freeaqingme)
Archiving this proposal, feel free to recover it when you want to work on it again. For more details see this email.