Unlike cache_clear_all in cache.inc and memcache.db.inc, the cache_clear_all in memcache.inc does not result in cache_page being cleared of temporary objects when the default system_cron runs (via cron.php).
Basically it is not respecting the call of cache_clear_all(NULL, 'cache_page'), and pages only get flushed if called as cache_clear_all('*', 'cache_page', TRUE)
Was there a specific reason for it to behave this way? before I go digging for the right way to "fix" this issue for me I want to make sure that there is not something that I am missing. I would have expected cache_clear_all to more or less behave exactly as the core one would, and it is even more confusing since is behaves differently than the database backed memcache.
Comments
Comment #1
febbraro commentedIt should also be noted that my memcache config is
Comment #2
robertdouglass commentedFrom looking through the commit history:
#292346: Cache is not invalidated after change of content
http://drupal.org/cvs?commit=79402
http://drupal.org/cvs?commit=98235
http://drupal.org/cvs?commit=150057
Comment #3
febbraro commentedRight, so cache_clear_all() still works for clearing the page and block cache after node saves b/c it calls back on itself with cache_clear_all('*', 'cache_page', TRUE). In the core version this would call cache_clear_all(NULL, 'cache_page') as a mechanism for clearing expired entries. system_cron calls to clear the page cache with cache_clear_all(NULL, 'cache_page') but that call no longer clears expired entries, it lands in no mans land and essentially does nothing.
I hope the above makes sense. :)
Comment #4
febbraro commentedBump. Wondering if anyone has thoughts in this one, this is a pretty major bug if you don't use DB backed memcache.
Comment #5
jeremy commentedMemcache handles cache expiration itself, so we can safely ignore the calls to cache_clear_all from system_cron(). I don't see a bug here.
Comment #6
febbraro commentedThe bug, as I'm experiencing it, is that the Drupal page cache is supposed to clear cached pages on cron runs. The memcache only version of cache.inc does not do this (but the db backed version does) thus once a page is cached it will never get flushed from the cache unless there is another event that causes cache purging (like a node save for example). The memcache-only version does not seem to expire these entries by itself, I have done some extensive testing of this. It does not seem right that the 2 different versions of cache.inc provided by this module function differently on cron runs.
How does the memcache-only version of cache.inc expect/handle the expiration of cached pages when no minimum ttl is set?
Thanks for helping.
Comment #7
crea commentedSubscribing
Comment #8
crea commentedI understand that flushing whole page cache on every cron event could be big performance hit for some sites. Posting here example of breakage for future reference, since there could be other modules expecting page_cache flushing on cron: http://drupal.org/node/504552#comment-2609926
Maybe we should add some configuration variable that allows to select between "flush cache_page on cron as core does" and "flush cache_page only during update events and set cache lifetime to N where N is 30 days by default".
UPDATE: it should be rather "flush expired data in tables immediately on cron as core does" and "flush expired data only during update events and set cache lifetime to N where N is 30 days by default", because this problem is related to all cache tables which are flushed like cache_clear_all(NULL, $table).
Comment #9
crea commented@febbraro
Memcache-only implementation does expiration too, but is setting expire time to 30 days which is unreachable for most sites. That's why you can't spot this during testing ;)
Btw, the whole idea of DB backed up Memcache was total crap, if you ask me. Why implement lightning fast Memcache and then block yourself in slow DB ? Fail-over ? Bullshit, for that there are Memcached distributed clusters. Waiting for slow DB cache operations together with Memcached operations totally kills the point of having Memcached.
So just skip that, and forget about DB part ;)
Comment #10
jmseigneur commentedSo is it possible to manually clear the caches with memcache.inc without having to wait 30 days? I've tried the different buttons to clear the caches but it seems that the caches are never cleared manually.
Comment #11
mafioso commentedI'm experiencing the same problem using memcache.inc, so i use memcache.db.inc at the moment.
If Jeremy and crea think that this is not a bug, i would say this is a critical feature request :)
Comment #12
jeremy commentedThis should now be fixed:
#572838: Old content served by Memcached after manual cache clear
#888002: Wildcard clear lock contention