ZF-11813: Zend_Cache_Backend_TwoLevels -> auto_refresh_fast_cache causes problems with cleaning by tag(s)

Issue Type: Bug Created: 2011-10-11T10:23:05.000+0000 Last Updated: 2012-08-24T21:11:20.000+0000 Status: Open Fix version(s): Reporter: Anton Stöckl (flytony) Assignee: Alexander Veremyev (alexander) Tags: - Zend_Cache

  • cache
  • zf-crteam-review

Related issues: Attachments:


The default for "auto_refresh_fast_cache" option in the TwoLevels Cache is true. Imho this is a bad idea as it causes problems when the flushing by tags is used. In my scenario the fast backend is memcached and the slow backend is file (but should be the same with all other backend combinations).

Let's assume the cache timeout is one hour. Let's further assume the website has at least some requests every couple of minues. With the "auto_refresh_fast_cache" option all hit cache items in the fast cache get their lifetime extended (endlessly, unless there is no cache hit for one hour). To the contrary the corresponding slow cache item expires after one hour. If there is a cleaning done by tags (e.g.: Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG) then the item in memcache will not be removed as expired items geet ignored:

<pre class="highlight">
if (time() > $metadatas['expire']) {

So we end up with a not deleted, not deletable (by tags) zombie item in memcache.

I don't see any good reason for the "auto_refresh_fast_cache" option to be true but in any case there should be a warning in the documentation (and also in the Class file) that this will cause problems when cleaning by tags is used! Imho the default should also be changed to "false" for this option.

Best regards, Anton


Posted by Anton Stöckl (flytony) on 2011-10-13T15:30:58.000+0000

Any reason why this fix: hast not made it into 1.11.11 (or before), by the way?

Posted by Gonzalo Sainz-Trapaga (gomox) on 2012-08-24T21:11:20.000+0000

This bit us real hard, please merge the above fix as it turns into a major headache in an impossible-to-reproduce way.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.