Skip to content

Enable file caching for anonymous users via mediawiki File cache#431

Merged
jetpham merged 1 commit intomasterfrom
jet/caching
Mar 10, 2026
Merged

Enable file caching for anonymous users via mediawiki File cache#431
jetpham merged 1 commit intomasterfrom
jet/caching

Conversation

@jetpham
Copy link
Copy Markdown
Member

@jetpham jetpham commented Feb 17, 2026

This was @danthedaniel 's idea originally so I looked up how to do it and this is what I found. I just wanted to open the PR at the least.

This implements file caching to serve static html to anonymous users and the cache be marked fresh for 2 hours.

https://www.mediawiki.org/wiki/Manual:File_cache is what this is based on

@jetpham jetpham self-assigned this Feb 17, 2026
@jetpham jetpham changed the title Enable file caching for anonymous users Enable file caching for anonymous users via mediawiki File cache Feb 17, 2026
@SuperQ
Copy link
Copy Markdown
Collaborator

SuperQ commented Feb 17, 2026

We already have memcached for caching. Is that not working?

@mcint
Copy link
Copy Markdown
Contributor

mcint commented Feb 17, 2026

We already have memcached for caching. Is that not working?

I think it caches intermediate php objects. Helpful for performance, including for logged in users.

For file cache, of ~rendered page objects, I enabled it, a week or two ago. There was lots of noise in the measurements, lighthouse/page speed insights. It might've improved page load speed from 1.2 to .8 range.

Copy link
Copy Markdown
Collaborator

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks.

I should really clean up our monitoring/grafana.

$wgUseFileCache = false;
$wgUseFileCache = true;
$wgFileCacheDirectory = '/var/cache/mediawiki/';
$wgShowIPinHeader = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manual:$wgShowIPinHeader - Removed in version: 1.27.0. Looks like adding cruft to me.

If $wgUseFileCache is enabled, setting $wgShowIPinHeader to true does not have any effect. Instead, it is automatically set to false at runtime.

Appropriate at one time.

@jetpham jetpham merged commit a7572b0 into master Mar 10, 2026
@jetpham jetpham deleted the jet/caching branch March 10, 2026 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants