On 10 November 2011 00:32, Brion Vibber <brion(a)wikimedia.org> wrote:
looking for a hook that is called when the text of an article is
parsed because of a cache miss.
What are you trying to accomplish with a hook that's called during (before?
after?) parsing that comes after a parser cache miss specifically?
S*mantic Forms form definition pages work to a degree similar to
templates, in that they have some explanatory text in <noinclude> tags
and the actual form definition in <includeonly> tags. Currently this
form definition is parsed every time a form is requested. I would like
to cache it. As I understood it, I can do that by setting a property
on the form definition page's ParserOutput object. So my idea was,
whenever there is a cache miss on the form definition page I parse the
part in <includeonly> tags and cache it along with the page. Then,
when a form is actually to be displayed I get the form definition text
from cache if available.
Keep in mind that the same article may be parsed with
configurations (thus separate cache keys) or may not get cached at all. It
also gets pre-rendered at default settings before we even check the cache
during saving -- would this count as a cache miss?
I don't think so. All I wanted was an "Ok, this is outdated, we have
to reparse", but I guess it is not that easy. :)
Is there somewhere (apart from the code) were I can read up on how
exactly caching works in MW?
* There seems
to be no elegant way to recognize if the text to parse is
the actual Article content.
You generally should not make such assumptions as, indeed, many bajillions
of things may get parsed, plenty of which are not standalone articles or
I noticed. :)