=== WP LCache === Contributors: getpantheon, danielbachhuber, stevector Tags: cache, plugin Requires at least: 4.3 Tested up to: 4.7.4 Stable tag: 0.5.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Supercharge your WP Object Cache with LCache, a persistent, performant, and multi-layer cache library. == Description == [![Travis CI](https://travis-ci.org/lcache/wp-lcache.svg?branch=master)](https://travis-ci.org/lcache/wp-lcache) [![CircleCI](https://circleci.com/gh/lcache/wp-lcache/tree/master.svg?style=svg)](https://circleci.com/gh/lcache/wp-lcache/tree/master) 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 object cache 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](https://github.com/lcache/lcache), a library that applies the tiered caching model of multi-core processors (with local L1 and central L2 caches) to web applications. WP LCache is faster than other object cache implementations because: * By using APCu, which is in-memory, WP LCache uses the fastest possible persistent object cache backend and avoids costly network connections on every request. When using a Memcached or Redis-based persistent object cache where Memcached or Redis is on a different machine, the millisecond cost of each cache hit can add up to seconds of network transactions on every request. * By incorporating a common L2 cache, WP LCache synchronizes cache data between multiple web nodes. Cache updates or deletes on one node are then applied to all other nodes. Without this synchronization behavior, APCu can't be used in server configurations with multiple web nodes because the cache pool is local to the machine. Still not convinced? WP LCache includes features that no one else has: * Cache groups are handled natively, meaning you can delete an entire group of keys with `wp_cache_delete_group()`. * WordPress' alloptions cache is sharded into distinct keys, mitigating cache pollution on high traffic sites. [Read #31245](https://core.trac.wordpress.org/ticket/31245) for all of the gory details. Read the installation instructions, then install WP LCache from [WordPress.org](https://wordpress.org/plugins/wp-lcache/) or [Github](https://github.com/lcache/wp-lcache). Go forth and make awesome! And, once you've built something great, [send us feature requests (or bug reports)](https://github.com/lcache/wp-lcache/issues). == Frequently Asked Questions == = Do you have benchmarks you can share? = We've done some rudimentary testing with New Relic on Pantheon infrastructure. [The results](https://twitter.com/outlandishjosh/status/775756511611990016) were substantial enough for us to begin using LCache in production. [Watch David Strauss' DrupalCon presentation](https://twitter.com/outlandishjosh/status/781281995213115396) for a more thorough explanation. If you'd like to do some benchmarking yourself, we'd love to hear about your testing methodology and conclusions. Caching is more of an art than a science, and outcomes can vary. Because cost of network transactions is one of the problems solved by WP LCache, the performance gains will be more impressive if you've historically been using Redis or Memcached on a separate machine. = Is APCu persistent like Redis is? = APCu is persistent through the life of a PHP-FPM process. However, unlike Redis, APCu doesn't save its state to disk at shutdown. When PHP-FPM is restarted, WP LCache will repopulate the L1 cache (APCu) from the L2 cache (database). == Installation == **WP LCache requires PHP 5.6 or greater with the APCu extension enabled.** To install WP LCache, follow these steps: 1. Install the plugin from WordPress.org using the WordPress dashboard. 1a. Those installing from Github will need to run `composer install --no-dev --no-scripts` after cloning to get the [LCache library](https://github.com/lcache/lcache). 2. Activate the plugin, to ensure LCache's database tables are created. These are created on the plugin activation hook. 3. Create a stub file at `wp-content/object-cache.php` to require `wp-content/plugins/wp-lcache/object-cache.php`. The `wp-content/object-cache.php` file should contain: