On Wed, Apr 9, 2014 at 6:29 PM, Brian Wolff <bawolff@gmail.com> wrote:

If you know the exact url of the api request, you can purge it on specific events (e.g. edits to a file page). But you need to know the precise url.

That's just sad... I was assuming Varnish supports some sort of tag-based invalidation, but apparently you have to pay for that [1].

It might be easier then to add a cache-breaking parameter to the API request URLs (something like the last file / file page modification date), and store that in the HTML. At least there is a sane invalidation mechanism for HTML pages. This would mean HTML pages needed to be invalidated when a new file is uploaded or the file page is edited, which sounds hard (cross-wiki invalidations, ugh) but not impossible. I assume something like that already exists for file uploads since the thumbnail URL might potentially change as a result.

Per the IRC discussion with Gilles, we should start caching filerepoinfo, userinfo, imageusage and globalusage right now, that's an easy win. Filerepoinfo and userinfo (gender) don't change much, imageusage and globalusage can, but meh, they are not very useful anyway, we only show the first three entries. Coming up with some sort of caching mechanism for imageinfo would be great, but sounds like an epic task.


[1] https://www.varnish-software.com/blog/advanced-cache-invalidation-strategies