Page MenuHomePhabricator

Make cache TTL configurable
Closed, ResolvedPublicFeature

Description

Currently, Wikibase requests are cached for only one minute.

The cache duration could be added as an argument to the getEntity method, i.e. mw.ext.UnlinkedWikibase.getEntity( id, ttl ).

The idea being that different usages on-wiki have different requirements for freshness of data. Some templates can decide that they don't care if a certain value is a week old, and in doing so reduce the number of remote requests that must be made to render a page.

Event Timeline

One other improvement for this could be to add a maintenance script to handle the updating of the cached data, rather than having it be done periodically during parsing.

Change 981945 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/UnlinkedWikibase@master] Add maintenance script for refreshing entity data

https://gerrit.wikimedia.org/r/981945

Change 995172 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/UnlinkedWikibase@master] Store page prop for all entities used on a page

https://gerrit.wikimedia.org/r/995172

Change 995172 merged by jenkins-bot:

[mediawiki/extensions/UnlinkedWikibase@master] Store page properties for all entities used on a page

https://gerrit.wikimedia.org/r/995172

Change #981945 merged by jenkins-bot:

[mediawiki/extensions/UnlinkedWikibase@master] Add maintenance script for refreshing entity data

https://gerrit.wikimedia.org/r/981945

Change #1013439 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/UnlinkedWikibase@master] Move URL-fetching to the job queue

https://gerrit.wikimedia.org/r/1013439

Change #1013439 merged by jenkins-bot:

[mediawiki/extensions/UnlinkedWikibase@master] Move URL-fetching to the job queue

https://gerrit.wikimedia.org/r/1013439

I think the last thing to do here is to make it keep working even with $wgMainCacheType = CACHE_NONE, which at the moment it can't because there's no way to pass the data back from the job runner.

Change #1077956 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/UnlinkedWikibase@master] Check cache QoS and fetch immediately if needed

https://gerrit.wikimedia.org/r/1077956

Change #1077956 merged by jenkins-bot:

[mediawiki/extensions/UnlinkedWikibase@master] Check cache QoS and fetch immediately if needed

https://gerrit.wikimedia.org/r/1077956

Talking to people about this some more, it sounds like there might not be any need to make the TTL configurable on-wiki, and for it to just be set to some sensible defaults such as caching indefinitely and refreshing at most every x hours.

Samwilson claimed this task.