[Mediawiki-l] Cached ContentActionUrls?

Brion Vibber brion at pobox.com
Thu Feb 9 00:55:51 UTC 2006


Tony Bowden wrote:
> I understand that protect will change the page's cache timestamp as the
> protection is a simple flag on the page, but I'm slightly confused by
> the watch/unwatch updating the user's cache timestamp, as this
> information isn't stored directly with the user data, and calling
> loadFromDatabase doesn't seem to re-load anything to do with the
> watchlist...

When something specific to a user changes how pages will display to him/her, the
user_touched timestamp is updated so pages cached by the browser from before the
change will be rerendered with the new settings.

A change of a page's watched state causes that page to display differently for
that user (but not for anyone else), so the user's cache-invalidation timestamp
is updated, not the page's.


Quick summary of HTTP caching:

When a resource is sent from the server to a client, it comes with a
Last-Modified timestamp, and perhaps some instructions on how the browser should
check for validity later. For most page views on the wiki, this instruction
tells the browser to go ahead and keep the page cached, but check back with the
server every time you visit it.

When you visit the same page again, the browser sends the previous timestamp
back as an If-Modified-Since header. MediaWiki compares this timestamp against
several cache-invalidation timestamps:

* the sitewide configuration variable $wgCacheEpoch
* the page_touched field of the current page
* the user_touched field of the viewing user

If the cached time is more recent than all of those, the server returns a '304
Not Modified' code, and the browser displays the page from its cache.

If the cached time is older than any of them, the server sends the whole page
again, and the new Last-Modified time is the most recent of all those times.

-- brion vibber (brion @ pobox.com)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : http://lists.wikimedia.org/pipermail/mediawiki-l/attachments/20060208/848c30c4/attachment.pgp 


More information about the MediaWiki-l mailing list