Issue Type: New Feature Created: 2012-05-18T15:59:34.000+0000 Last Updated: 2012-06-04T13:47:24.000+0000 Status: Open Fix version(s): Reporter: Alexandre Ravey (alexandre.ravey) Assignee: Alexander Veremyev (alexander) Tags: - Zend_Cache
Related issues: Attachments:
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.
No comments to display
Have you found an issue?
See the Overview section for more details.