Linux 软件免费装

WP LCache

开发者 getpantheon
danielbachhuber
stevector
更新时间 2019年5月1日 07:56
PHP版本: 4.3 及以上
WordPress版本: 5.2
版权: GPL-2.0
版权网址: 版权信息

标签

caching cache performance apc apcu lcache object-cache

下载

0.3.1 0.5.0 0.5.1 0.5.2 0.6.0 0.6.1 0.1.0 0.2.0 0.2.1 0.2.2 0.3.0 0.4.0

详情介绍:

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, a library that applies the tiered caching model of multi-core processors (with local L1 and central L2 caches) to web applications. Note: WP LCache development is currently on hold, and not recommendated for production use, due to an issue with APCu cache fragmentation. WP Redis, also maintained by Pantheon, is a great alternative. WP LCache is faster than other object cache implementations because: Still not convinced? WP LCache includes features that no one else has: 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. 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.
  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: <?php Engage LCache object caching system. We use a 'require_once()' here because in PHP 5.5+ changes to symlinks are not detected by the opcode cache, making it frustrating to deploy. More info: http://codinghobo.com/opcache-and-symlink-based-deployments/ $lcache_path = dirname( realpath( FILE ) ) . '/plugins/wp-lcache/object-cache.php'; require_once( $lcache_path ); To install WP LCache in one line with WP-CLI: wp plugin install wp-lcache --activate && wp lcache enable If you need to install APCu, the PECL installer is the easiest way to do so. Enabling APCu for CLI is a matter of adding apc.enable_cli='on' to your etc/php5/cli/php.ini. If you can't easily use PHP 5.6 or greater, you should switch to a more responsible hosting provider. Admin Notices If any of the requirements for LCache to function are not met, you will see an admin notice indicating the issue. Here's how to resolve issues for each possible dependency:

升级注意事项:

0.2.2 Existing WP LCache users will need to alter the value column on the lcache_event table from BLOB to LONGBLOB.

常见问题:

Do you have benchmarks you can share?

We've done some rudimentary testing with New Relic on Pantheon infrastructure. The results were substantial enough for us to begin using LCache in production. Watch David Strauss' DrupalCon presentation 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).

Why am I seeing heavy database load from WP LCache?

When you first enable WP LCache, you'll have a good amount of database activity as it writes all cache entries to the database. Eventually, as long as your codebase is optimized, database activity will die down and most activity will be in APCu. However, if your codebase isn't optimized, you'll see continued database load. Some common issues include:

  • Frequent calls to wp_cache_flush(), which empties the entire cache and requires the L2 to be completely repopulated.
  • Redundant or duplicative calls to wp_cache_set(), where code paths hardly ever use the cache values they set.
In both of these cases, any persistent object cache drop-in probably isn't going to be useful until you solve your code problems.

更新日志:

0.6.1 (October 3rd, 2017) 0.6.0 (August 28th, 2017) 0.5.2 (May 3rd, 2017) 0.5.1 (April 25th, 2017) 0.5.0 (November 2nd, 2016) 0.4.0 (October 5th, 2016) 0.3.1 (September 22nd, 2016) 0.3.0 (September 21st, 2016) 0.2.2 (September 14th, 2016) 0.2.1 (September 14th, 2016) 0.2.0 (September 14th, 2016) 0.1.0 (September 7th, 2016)