XCache
- Moodle 2.4–2.5
- 更新 2013-04-12
XCache is a PHP opcode cacher designed to accelerate the performance of PHP execution. One of the features it provides is a variable data store that can be used within PHP code to persist variables between requests.
This plugin is an XCache cache store designed to utilise that variable data store and allow Moodle to make better use of XCache.
Information and advice on using XCache within Moodle
XCache provides a shared application cache that is usually very limited in size but provides excellent performance.
It doesn’t provide the ability to configure multiple instances of itself. Moodle allows the admin to create several XCache instances however the prefix for each must be unique as they will all exist within the single XCache variable data store.
Because of its incredible performance but very limited size it is strongly suggested that you map only small, crucial caches to the XCache store.
Also recommended is to map a secondary application cache instance to any definition with the XCache mapped. This ensures that should the XCache data store fill up there will be an alternative cache available.
Installation of XCache
For those running an Linux distro and having installed PHP through a package manager I would recommend first checking your package manager to see if an XCache package is provided. If so I would certainly recommend installing through the package manager as it is by far the easiest route.
Through Ubuntu/Debian this can be achieved using the following command:
sudo apt-get install php5-xcache
It is recommended to follow the installation instructions that XCache provide.
You can download XCache from http://xcache.lighttpd.net/wiki/ReleaseArchive . I recommend using the latest stable version.
Installation depends upon whether you are installing from source, or installing a prebuilt binary package.
Documentation on both methods can be found at http://xcache.lighttpd.net/wiki/DocToc (Look for the Install from … links on the right)
Configuring XCache for use
Detailed information about the ini settings can be found at http://xcache.lighttpd.net/wiki/XcacheIni .
There are a couple that we recommend understanding as they are vital to the use of this plugin.
# Controls the size of the variable cache available through XCache.
# It must be set > 0 in order for the this plugin to be usable.