Release status: stable
|Description||Provides an interface for checking if Memcached is working fine|
|Latest version||2.0.0 (2020-06-03)|
|License||GNU General Public License 3.0 or later|
The Memcached extension provides an interface for checking if Memcached is working fine.
When I installed Memcached on my wiki server I had a problem to regularly check if it works fine or should be restarted. Because sometimes it crashes and the wiki opens way too long which is annoying. I assume this happens when Memcached works many days non-stop. So I added a cron task to restart the Memcached service once a day in case it crashes again. But what if it crashes before the cron task runs? All users have to wait until it is restarted.
So every day I have to login through SSH to check the status of Memcached service. This is boring to type login and password each time. There should be an easier way. At first I found a PHP-script for checking Memcached status. It was good but was allowed to run by everyone who knew its file name. For security purpose we don't want anyone to find out the IP and port of our Memcached server(-s). Thus I came to the conclusion: it would be great to implement it as a MediaWiki extension and deny access for everyone but admin.
Since I didn't find any Memcached extension at all (which is shame because, for instance, APC extension existed for a long time), I decided to create my own. I've been modifying plenty of MediaWiki extensions for myself but never created one. This is my first separate extension so suggestions are welcome.
First of all, you need to install Memcached and define its servers in $wgMemCachedServers. Don't forget to install PECL memcache for PHP (do not confuse with PECL memcached which is currently not supported).
If you've already done it go to "Special:Memcached" and you'll see the list of memcached servers with their status (working, not working or no memcache service found).
- Download and place the file(s) in a directory called
- Only when installing from git run Composer to install PHP dependencies, by issuing
composer install --no-devin the extension directory. (See task T173141 for potential complications.)
- Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'Memcached' );
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
- User rights
- memcached - the right to view the Special:Memcached page. By default allowed only for bureaucrats. You may change it if you wish.
- Memcached on Wikipedia