Zend\Cache MongoDB Storage Adapter + Questions

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Zend\Cache MongoDB Storage Adapter + Questions

Anton Stöckl
I've (finally) started working on the MongoDB storage adapter for
Zend\Cache, which I was planning to do before ZF2 was launched (but then
we launched our fist daughter ... ;-) )
It should be finished soon, though.

I'm currently trying to fix my code until no tests from
CommonAdapterTest are failing, after that I'll add more specific tests
to my MongoDBTest class.

I was really surprised that there's still no MongoDB storage adapter
yet, I strongly believe that MongoDB is (by far) the best storage
adapter for a cache. It's almost as fast as Memcached in read and write
plus it has a lot of capabilities that make it superior:

* supports almost all data types natively as the json / bson format is
very close to objects _and_ hash arrays
* it is taggable - a capability which imho is the key to _serious_
caching (flushing by tag)
* it now supports auto expiry via expiring indexes

It even has more superpowers like manipulating arrays in various ways, I
might think about new capabilities in some later version of the adapter.

Here's my questions / problems:

The adapter has capabilities that the user can get via getCapabilities()
which proxies to internalGetCapabilities().
This defines supportedDatatypes amongst other stuff.
But the Zend\Cache code itself does not use the information about
supportedDatatypes if I'm not missing something. Specifically there's
the Serialize plugin which - instead of using that information to find
out what it needs to serialize - serializes every data type. Wouldn't it
be better if it serializes only data types that are not natively supported?