Topic on Project:Support desk

Run All Cache Invalidations

8
Jabowery (talkcontribs)

How does one run all cache invalidations subsequent to updating a template?

I'm making extensive use of templates to simulate what might be thought of as a "Documented Spreadsheet" and can't afford to present invalid cached HTML after an update. Moreover, I don't want to recalculate all HTML cached pages after an update since many pages may have fallen into obsolescence but not yet been deleted for historical purposes.

TheDJ (talkcontribs)

The Job_queue is responsible for updating anything that needs updating. Many wikis have not installed or effectively tweaked the processing rate of their wiki installation and that will cause updates to other pages to take long

Jabowery (talkcontribs)

I take it, then, that there is no answer to my question. Hence I must modify the maintenance/runJobs.php script to accept an argument that runs only the cache invalidations?

Bawolff (talkcontribs)

the job queue doesn't do much else in a default setup other than run cache invalidations, so its a confusing question (yes, some extensions use it for other things, but you probably aren't using them)


If your goal is to blanket clear all cache, you can do that by making a dummy edit to LocalSettings.php (makes the page update but not categories). If you need to reset all categories/other links, run refreshLinks.php

Jonathan3 (talkcontribs)

You could just leave a terminal window open and run php runJobs.php whenever you make a change to your template. I don't know of any web interface way of doing this if you don't have shell access. (Hope I'm using the right terminology here.) I guess someone could write an extension that creates a special page to do it.

Or maybe you could use Extension:MagicNoCache and add __NOCACHE__ to the pages that use the template, so that the page never gets cached and always uses the latest version of the template.

Jabowery (talkcontribs)

I already gave up on a web interface and assumed I'd have to use maintenance/runJobs.php but then I ran into a problem:

It seemed as though runJobs was doing a lot more than merely invalidating the pages that depended directly and/or indirectly on the edited template. ie: It seemed as though runJobs.php was re-rendering all of those pages. Was I mistaken?

PS: When I tried php runJobs.php --type htmlCacheUpdate it seemed as though it did a lot less work even than just invalidating dependent and/or indirectly dependent pages, ie: It seemed to be invalidating only directly dependent pages.

Bawolff (talkcontribs)

> I already gave up on a web interface

and Johnathan wrote > I don't know of any web interface way

To clarify, the web interface here would be setting $wgJobRunRate to some non zero number (e.g. 4). The two options are not mutually exclusive, you could have both command line and web job runner.

> It seemed as though runJobs.php was re-rendering all of those pages. Was I mistaken?


Yes. RunJobs.php wont invalidate all pages, but maybe you did something to invalidate other pages without realizing, or maybe they were invalidated a long time ago and the job is just running now. If you've edited a template used on every page, it will invalidate them all.

> PS: When I tried php runJobs.php --type htmlCacheUpdate it seemed as though it did a lot less work even than just invalidating dependent and/or indirectly dependent pages...

Note that htmlCacheUpdate does not fully refresh a page. If the template contains category changes, etc. Its the RefreshLinkUpdates job not the htmlCacheUpdate that does that part of the update.

> ie: It seemed to be invalidating only directly dependent pages.

Different actions might trigger different invalidations. Actions that dont effect indirect dependencies (e.g. whether a link is red or blue after a page creation) dont purge the indirect dependencies.

Jabowery (talkcontribs)

By "those pages" I was referring to "pages that depended directly and/or indirectly on the edited template". So if I understand your sentence: "If you've edited a template used on every page, it will invalidate them all," you're saying `runJobs` with no arguments will invalidate all cached renderings of "pages that depended directly and/or indirectly on the edited template" but it will not re-render (or "refresh" to use your term?) those pages. Is that correct?

Reply to "Run All Cache Invalidations"