* (bug 3175) update filenames in documentation files
[lhc/web/wiklou.git] / docs / linkcache.txt
1 linkcache.txt
2
3 The LinkCache class maintains a list of article titles and
4 the information about whether or not the article exists in
5 the database. This is used to mark up links when displaying
6 a page. If the same link appears more than once on any page,
7 then it only has to be looked up once.
8
9 In practice, what happens is that the global cache object
10 $wgLinkCache is consulted and updated every time the function
11 getArticleID() from Title is called.
12
13 This has a side benefit that we take advantage of. We have
14 tables "links" and "brokenlinks" which we use to do things
15 like the Orphans page and Whatlinkshere page. It just so
16 happens that after we update a page, we display it--and as
17 we're displaying it, we look up all the links on that page,
18 causing them to be put into the cache. That information is
19 exactly what we need to update those two tables. So, we do
20 something tricky when we update pages: just after the update
21 and before we display, we clear the cache. Then we display
22 the updated page. Finally, we put a LinksUpdate object onto
23 the deferred updates list, which fetches its information from
24 the cache.
25
26 There's a minor complication: displaying a page also looks up
27 a few things like the talk page link in the quick bar and the
28 date links. Since we don't want those in the link tables, we
29 must take care to suspend the cache while we look those up.
30 Skin.php does exactly that--see dateLink(), for example.
31