[development] Design Flaws in Drupal Caching System

Alex Markley alex at malexmedia.net
Tue Jul 25 22:04:42 UTC 2006


Hey all!

I'm sure most of you are busy with other stuff, but I thought I'd make
some noise about this issue because it represents a potentially serious
design flaw in the caching system.

My original, scatter-brained report is here: http://drupal.org/node/75186

I'm not terribly familiar with the caching system as it is, and I know
there are other discussions going on about improving it. Thus, I'm not
interested in trying to "tell people like it is" or stepping on anybody's
toes. I'm just trying to bring up an issue that I know exists and have
confirmed to be a problem in 4.7.2.

Specifically, while Drupal does a really great job of caching all pages
generated by anonymous requests, it does a really, really crappy job of
clearing them.

Unless I'm mistaken, I don't see any maximum lifetime for cache entries,
which I believe to be design flaw number one. Even if that maximum
lifetime is over a month, it still protects Drupal-powered sites from
serving year-old stale/invalid content to anonymous users.

Design flaw number two is that many content updates don't clear any cache
entries, resulting in bad/stale content being served to anonymous users:

==> Example: At the moment, admin/node operations immediately result in
stale content because they don't trigger any cache deletions.

==> Example: User profile updates immediately result in stale content
because they don't trigger any cache deletions.

Design flaw number three (my favorite one) has to be the complete and
utter lack of an intelligent cache clearing mechanism.

For example, why in the name of heaven does node_save do a
cache_clear_all(); ?! It should be calling a hook that allows interested
modules to clear cache entries that they created! That would prevent good
cache entries from being deleted and ensure that old cache entries are
deleted on the spot.

I guess my beef is that irresponsible modules are failing to clear cache
entries when they are rendered invalid, and hacks like calling
cache_clear_all(); from node_save() are short-sighted at best.

This problem is bad enough to make me seriously consider the sanity of
enabling the cache on my site at all, since anonymous users are my primary
audience.

Feel free to disagree.

ttyl
--Alex Markley (Malex)
http://MalexMedia.Net/




More information about the development mailing list