Alternative PHP cache (APC)
- Moodle 2.4–2.7
- 更新 2014-05-14
The alternative PHP cache (APC) is an opcode cache for PHP that provides a persistent application data store cache to PHP applications.
This plugin allows the use of that APC data store as a Moodle cache store. In turn allowing you to use APC within Moodle.
Information and advice on using APC within Moodle
APC 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 and as such within Moodle you are only able to create a single APC cache store instance.
Because of its incredible performance but very limited size it is strongly suggested that you map only small, crucial caches to the APC store.
Another important thing to understand about the APC store is that it provides no garbage cleaning, or storage reclamation facilities. As such cache data will persist there until APC is restarted or the store is purged.
On top of that once the store is full requests to store information within the cache fail until there is once more sufficient space.
Because of this it is recommended that you regularly purge or restart APC.
Also recommended is to map a secondary application cache instance to any definition with the APC mapped. This ensures that if it does indeed full up that an alternative cache is available.
Installation of APC
It is recommended that you read through the APC documentation http://www.php.net/manual/en/book.apc.php before beginning with this plugin.
The above documentation recommends installing the PECL APC extension that can be found at http://pecl.php.net/package/apc .
http://www.php.net/manual/en/install.pecl.php contains information on installing PECL extensions.
Its also worth noting for this those using Linux that there is usually a php5-apc package that can be installed very easily.
If you have installed PHP under Linux through a package manager then this will be by far the easiest way to proceed.
Once installed ensure you restart your web server before proceeding.
Installation within Moodle
Browse to your site and log in as an administrator.
Moodle should detect that a new plugin has been added and will proceed to prompt you through an upgrade process to install it.