MediaWiki and Caching
Caching is method of storing information you get from other places locally on the computer that you are using. Understanding how caching works will save you countless hours of frustration of making changes, and then troubleshooting as to why the changes you have made do not appear on your website. There are two different caches that you will have to contend with. The first is browser cache that is kept locally on your computer. The second is the cache of information that is on a web server.
Every time you access a page on the internet from your web browser, your computer actually stores the information from the web site you are accessing onto your computer’s hard drive or in your computer’s memory. The information you see on your screen is actually coming directly from your computer, and only indirectly from the website you are viewing. This is useful because cashing makes your browsing experience much faster. Pages that you visit often will load up quickly, since they are already on your computer. This type of cache is called your browser cache.
In addition to the, software programs such as MediaWiki also utilize caching in serving up pages. For example, the first time a pages is accessed on your wiki, MediaWiki requests the latest information from its database and actually writes that information to a static page. The next time that article is accessed, MediaWiki automatically serves up the cached page instead of requesting the information from the database each time. This reduces server load and makes MediaWiki and the website perform much faster. There are other kinds of server-side caching too such as memcached.
Advantages of Caching
Cashing allows performance can be increased for several reasons. First, because the information is local, it requires a shorter “trip” to access that information, making access faster. Second, because you are accessing the information locally, it places less strain on the bandwidth and processing power necessary to access the information from the database, or to move the information from the internet or network to your computer. Finally, it saves resources in terms of time and money because the information does not have to be re-processed and sent from the database or host computer each time you need to access it. While it may seem trivial to send just a single file across the internet, multiplied by frequency of access, this becomes a paramount concern for managing resources for database, servers, and bandwidth performance. Caching save money, time and energy by reducing bandwidth overhead. Simply put, caching is “green friendly”
Disadvantages of Caching
The primary disadvantage to caching is that you have a much higher chance of aged data. Since the information comes from a local computer’s cache or remote server’s cache, it is not necessarily the latest information that is on the website, or in the database.
Get the Latest Information- Refresh
Get the Latest Information- Purge
To get the latest information from MediaWiki, it is important that you understand the basics of the Purge action. To reduced overhead and increase performance, every article you view from a website running MediaWiki comes from a cached page (in most cases).
To be sure you are accessing the latest version of an article, you simply need to append &action=purge to the end of the URL for the article you want to refresh.
Note: Remember to change the "example.org" to match the host name of your actual Wiki. Note that hitting refresh on your web browser will just get a new copy of the cached page served from MediaWiki.
Purging is a useful and necessary step when employing advanced wiki techniques such as modifying templates, working with the design and layout of a page, and working with extensions such as DPL, Semantic, and Widgets.
To make sure you are getting the current version of an article from MediaWiki, you need to do both of the following two steps:
- Ctrl or Command-F5
- append &action=purge to the end of the website address.
Extension Tip: http://www.mediawiki.org/wiki/Extension:Purgetab MediaWiki Manual: http://www.mediawiki.org/wiki/Manual:Cache