Interwiki cache

MediaWiki has a database table (interwiki table) for interwiki prefixes. This is by default used directly, but two types of caching can be used for better performance.

"Interwiki cache" can thus refer to two types of caching, but in Wikimedia context it usually refers to CDB caching.

Database and memcached
When memcached is enabled, the interwiki prefixes of the database table will be cached too. This can be controlled using the $wgInterwikiExpiry setting.

This cache can be cleared using the clear_interwiki_cache.php script. It removes the caching based on the prefixes found in the database table.

CDB interwiki cache
When $wgInterwikiCache is set to point to a CDB file, that file is then used as a replacement for the database.

MediaWiki does not contain a script to build or update such a CDB cache file (bug 33395), however WikimediaMaintenance contains dumpInterwiki.php and rebuildInterwiki.php which are custom Wikimedia-specific scripts used for the CDB cache of all Wikimedia wikis.

The $wgInterwikiScopes and $wgInterwikiFallbackSite settings are used for this caching.

Retrieving interwikis
To view the interwiki prefixes, you can use the API (action=query&meta=siteinfo&siprop=interwikimap) or install the Interwiki extension. These return the prefixes in the database table, and since MW 1.19 these will also work correctly for CDB cached interwiki prefixes. When using memcached, they will return prefixes directly from the database so there may be a slight difference because the database may have been modified since the last cache version.