On Mon, 28 Feb 2005 22:22:25 +0100, Sebastien BARRE
<sebastien.barre(a)kitware.com> wrote:
At 2/28/2005 07:58 PM, Rowan Collins wrote:
The point is, this is a chicken-and-egg problem -
if the page is being
read from cache, there is no way of knowing whether or not it contains
an extension tag, or any other feature.
Unless I'm missing something, it does seem possible to me, I'm pretty sure
it's done for other features: when you edit the page and save it, it is
parsed and tables in the database are modified accordingly. For example,
the links, categorylinks, imagelinks tables, etc. So at that time, you can
detect an extension tag in the page, and fill an extensionlinks table for
example, with ids of the pages using extensions. You don't even need to
actually refer to any extension, so it would basically be one column if
needed. When it's time to serve the page, check the table to see if that
page uses an extension, otherwise use the cache, etc. Am I correct ?
Well, yes, that's more-or-less similar to what I was saying - the
crucial point is that you have to decide whether it should be read
from cache *next* time, not *this* time. I guess I misunderstood what
you were saying in the first place, because you made it sound like the
process was [detect tag] -> [recreate content], whereas it would
actually be more like [detect tag] -> [flag article as dynamic] and
then later [detect dynamic flag] -> [ignore cached copy]
After thinking about it for a while, I went further and, rather than
having an is_dynamic flag (which would be just one field in the cur /
revision / whatever table, you don't need a whole new table for it)
and storing a cached copy that you know you're not going to use, I
suggested just not caching it in the first place. If there isn't a
cached copy there, there's no need to decide whether to recreate the
page or not, because you'll have to! In other words
Current / normal: [parse] -> [store in cache] and on request [check
cache] -> [load from cache]
Proposal for "dynamic pages": [parse] {[detect tag] -> [disable
cache]} and on request [check cache] -> [can't load from cache, so
parse again]
One gotcha for anyone wanting to implement this is that if you have a
template with dynamic content in it, you've got to make sure that
neither the template itself *nor* pages containing that template get
cached. But I think that may turn out to be easier if you're just not
creating cached copies too - any activity that could possibly result
in a cached copy will have to call your extension, so it will trigger
the cache-bypass variable.
--
Rowan Collins BSc
[IMSoP]