Extension:ScheduledCacheExpiry
| This extension is not fully functional under miser mode due to a change in MediaWiki core introduced by commit 3ba2dc9. |
Release status: beta |
|
|---|---|
| Implementation | Parser function |
| Description | Adds parser functions for controlling a page's parser cache expiry. |
| Author(s) | Universal Omega |
| Latest version | 1.0.0 |
| MediaWiki | 1.46+ |
| Database changes | No |
| Licence | GNU General Public License 3.0 or later |
| Download | GitHub |
The ScheduledCacheExpiry extension lets editors control how long a page's parsed output can remain cached. This is useful for pages containing time-sensitive content, such as showing birthdays messages.
Installation
[edit]- Download and place the file(s) in a directory called
ScheduledCacheExpiryin yourextensions/folder. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'ScheduledCacheExpiry' );
- Configure as required.
Done – Navigate to Special:Versionon your wiki to verify that the extension is successfully installed.
Usage
[edit]Update daily
[edit]{{#cachedaily:}}
Sets a cache lifetime of 24 hours from when the page is parsed.
Update at specified times
[edit]The parser function below sets the cache expiry time to 03:00 in the configured timezone.
{{#cacheuntil:03:00}}
To specify more than one time, separate them with commas:
{{#cacheuntil:03:00,15:00}}
Note that the minimum cache expiry time still applies. If a page is parsed 10 seconds before the chosen time, while the minimum cache expiry is 6 hours, then the page's cache will be invalidated in 6 hours instead of 10 seconds.
Update after a fixed interval
[edit]The example below sets a cache expiry of 6 hours from when the page is parsed.
{{#cacheinterval:21600}}
The number is in seconds. Values below the configured minimum in $wgScheduledCacheExpiryMinimumExpiry are raised to that minimum.
Configuration
[edit]$wgScheduledCacheExpiryMinimumExpiry- Minimum cache expiry time in seconds.
- Default:
60.
$wgScheduledCacheExpiryTimezone- Timezone used to interpret
#cacheuntiltimes, for example'America/New_York'. An invalid timezone name falls back to UTC. This setting is independent of each reader's timezone preferences. - Default:
'UTC'.
See also
[edit]- Extension:MagicNoCache, which completely disables the parser cache
- UpdateDaily, an extension by wiki.gg that only allows setting the parser cache expiry to 24 hours.
- Manual:Parser cache
- Manual:$wgParserCacheExpireTime
| This extension is maintained by Miraheze. Some Miraheze extensions are very Miraheze-specific and you may encounter issues you don't see on Miraheze. To report a bug or request a configuration change, please do so on the Miraheze Issue Tracker and not on Wikimedia Phabricator. |
| This extension is included in the following wiki farms/hosts and/or packages: |
