Issues

ZF-12216: Zend_Cache_Backend_Apc rewrite, now supports tags

Description

Here is a rewrite of the APC backend. Based on File backend and older Apc backend implementation.

So, jumping right to the hot topic, how to handle metadatas on a volatile cache? I've investigated two approaches. In each case the challange is to be able to detect a missing metadata for a cache entry or a missing cache entry for a metadata and clean the corruption.

A) Same as Zend_Cache_Backend_File, one metadata entry per cache entry. B) One big metadata storage for all cache entries.

Each have their pros and cons. Finally plan B was used. Mainly for the ease of use and the speed for small to medium caches. (Namely, less than 10k entries)

I don't think this implementation is perfect, but it's a good start.

It's compatible with the old Zend_Cache_Backend_Apc but the internal storage is different. Cache entries created by the older one will be load()able but any call to test() or touch() will invalidate them gracefully.

It passes all unit tests plus the extended tests, same as the Zend_Cache_Backend_File tests. Also passes the new tests I submitted in ZF-12212.

Some points: - The cache is self-cleaning. If a value dangle with no metadatas, any call to clean() (in any mode) will purge it from the cache and rebuild the matadatas. - If the metadatas fall of the cache, every values are cleaned. (Blind clean based on prefix). - A new apc_id_prefix has been added to the backend options. It let multiple instances use the same Apc cache. It's also possible tu use the cache directly, call to clean will not interfere with data which has not been added by us. - Loading (via load()) a value when the metadatas are not available will work. All other operations will purge it from the cache.

Known limitations: - Race condition when more than one process try to save the metadatas. The last win. Not a big issue, metas are NOT used for load and all errors are handled gracefully.

The Zend_Cache_Backend_Apc patch: http://pastebin.com/UAs5A8bT The Zend_Cache_ApcBackendTest patch: http://pastebin.com/Puh76Bug

Comments

No comments to display