symfony/symfony — pull request #7986 by jfsimon (2013-05-09 11:48:02+00:00)
Title: [POC] Cache component

Yes, another cache component POC. I was boring this morning and thinking to this to-come component. I searched for PRs and discussions and didn't found anything in active development. So I looked at *zetacomponents* and *zend-framework*. The fact is that I could not find satisfying implementation, so I decided to create my own.

I truly believe in *open/close* principle. We can't know what people want to do with our libraries, how much they need to hack them, so they have to be really extensible. That said we need to keep API simple and rigid (no hundreds-of-public-methods class, no god objects, no magic, no tricks).

Maybe you'll find this POC stupid, or absolutely outrageous. Maybe there are some good ideas. Please tell me, I'm ready for advices, compliments or injures. Notice that it's maybe too soon for typo or naming fixes ;)

**I tried to follow some rules in this POC:**
* have a dead simple API
* have a highly extensible component
* permit to store/fetch/delete data easily
* easily add global namespace to cache keys
* permit to attach metadata to stored data and keep them synchronized through the cache
* permit to add tags metadata and retrieve data by tag easily
* have something similar to what is proposed in *php-fig* issues

**To see how it works, you can take a look at acceptance tests:**
* core: https://github.com/jfsimon/symfony/blob/poc-cache-component/src/Symfony/Component/Cache/Tests/Acceptance/CoreTest.php
* metadata: https://github.com/jfsimon/symfony/blob/poc-cache-component/src/Symfony/Component/Cache/Tests/Acceptance/MetadataTest.php
* tag: https://github.com/jfsimon/symfony/blob/poc-cache-component/src/Symfony/Component/Cache/Tests/Acceptance/TagTest.php

**Backlog:**
* [x] implement component's core
* [x] implement core extensions
* [x] implement metadata extension
* [x] implement tag extension
* [x] implement array driver
* [x] add basic acceptance tests
* [ ] have better exception messages
* [ ] add copyright files header ;)
* [ ] implement APC driver
* [ ] implement memcache driver
* [ ] implement memcached driver
* [ ] optimize queries made to driver by grouping them
* [ ] add an event listener extension (and dispatch events)
* [ ] add composer/readme/license
* [ ] write documentation