Contributors: getpantheon, danielbachhuber, stevector
Tags: cache, plugin
Requires at least: 4.3
Tested up to: 4.6.1
Stable tag: 0.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Supercharge your WP Object Cache with LCache, a persistent, performant, and multi-layer cache library.
For sites concerned with high traffic, speed for logged-in users, or dynamic pageloads, a high-speed and persistent object cache is a must. WP LCache improves upon Memcached and Redis implementations by using APCu, PHP's in-memory cache, in a way that's compatible with multiple web nodes.
Under the hood, WP LCache uses LCache, a library that applies the tiered caching model of multi-core processors (with local L1 and central L2 caches) to web applications. In this configuration, APCu is the L1 cache and the database is the L2 cache. APCu traditionally can't be used on multiple web nodes because each web node represents a different cache pool. Because WP LCache has a database-based L2 cache, a cache update or delete on one node can then be applied to all other nodes.
Read the installation instructions, then install WP LCache from WordPress.org or Github.
Go forth and make awesome! And, once you've built something great, send us feature requests (or bug reports).
WP LCache requires PHP 5.6 or greater with the APCu extension enabled. If you're running an older PHP version, or APCu is unavailable, you'll see an admin notice in your WordPress dashboard.
To install WP LCache, follow these steps:
- Install the plugin from WordPress.org using the WordPress dashboard or WP-CLI.
1a. Those installing from Github will need to run
composer install --no-dev
after cloning to get the LCache library. - Activate the plugin, to ensure LCache's database tables are created. These are created on the plugin activation hook.
- Symlink the object cache drop-in to its appropriate location:
cd wp-content; ln -s plugins/wp-lcache/object-cache.php object-cache.php
If you need to install APCu, the PECL installer is the easiest way to do so.
- PHP 7.0:
pecl install apcu
- PHP 5.6:
pecl install channel:https://pecl.php.net/apcu-4.0.11
If you can't easily use PHP 5.6 or greater, you should switch to a more responsible hosting provider.
The best way to contribute to the development of this plugin is by participating on the GitHub project:
https://github.com/lcache/wp-lcache
Pull requests and issues are welcome!
You may notice there are two sets of tests running, on two different services:
- Travis CI runs the PHPUnit test suite in a variety of environment configurations (e.g. APCu available vs. APCu unavailable).
- Circle CI runs the Behat test suite against a Pantheon site, to ensure the plugin's compatibility with the Pantheon platform.
Both of these test suites can be run locally, with a varying amount of setup.
PHPUnit requires the WordPress PHPUnit test suite, and access to a database with name wordpress_test
. If you haven't already configured the test suite locally, you can run bash bin/install-wp-tests.sh wordpress_test root '' localhost
. You'll also need to install and configure APCu in order to run the test suite against APCu.
Behat requires a Pantheon site. Once you've created the site, you'll need install Terminus, and set the TERMINUS_TOKEN
, TERMINUS_SITE
, and TERMINUS_ENV
environment variables. Then, you can run ./bin/behat-prepare.sh
to prepare the site for the test suite.
- Bug fix: Properly flushes entire LCache with
wp_cache_flush()
is called. Previously, LCache was called improperly, meaning none of the cache was flushed.
- Updates LCache to v0.3.0, fixing issues with faulty expiration.
- Initial release.