From 0b082eff82d5cdbe24aba3ff10eeb0994ebe233a Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Thu, 6 Apr 2023 16:11:34 -0600 Subject: [PATCH] Release 1.3.5 (#397) * [CMS-1033] Add GH action for deployments to wp.org (#368) * Make dependabot target develop branch (#376) * Declare wp_cache_supports function and support features (#378) * Fix broken wp_cache_supports() (#382) * Update images for lint and test-behat jobs * Bump yoast/phpunit-polyfills from 1.0.3 to 1.0.4 * Bump dealerdirect/phpcodesniffer-composer-installer from 0.7.2 to 1.0.0 Bumps [dealerdirect/phpcodesniffer-composer-installer](https://github.com/Dealerdirect/phpcodesniffer-composer-installer) from 0.7.2 to 1.0.0. - [Release notes](https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases) - [Changelog](https://github.com/PHPCSStandards/composer-installer/blob/main/.github_changelog_generator) - [Commits](https://github.com/Dealerdirect/phpcodesniffer-composer-installer/compare/v0.7.2...v1.0.0) --- updated-dependencies: - dependency-name: dealerdirect/phpcodesniffer-composer-installer dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Bump grunt from 1.5.2 to 1.6.1 (#386) * [CMSP-223] WP Redis housekeeping (#387) * [CMS-1033] Release 1.3.0 (#371) * [BUGS-5583] Release 1.3.1 (#379) * Release 1.3.2 (#383) * add spdy-compatible license version * remove reference to package.json --------- Co-authored-by: John Spellman * [CMSP-72] PHP 8.2 compatibility (#388) * [BUGS-5623] Set missing_redis_message if Redis service is not connected (#391) * Set missing_redis_message if Redis is not connected * i18n * Bump yoast/phpunit-polyfills from 1.0.4 to 1.0.5 (#394) Bumps [yoast/phpunit-polyfills](https://github.com/Yoast/PHPUnit-Polyfills) from 1.0.4 to 1.0.5. - [Release notes](https://github.com/Yoast/PHPUnit-Polyfills/releases) - [Changelog](https://github.com/Yoast/PHPUnit-Polyfills/blob/2.x/CHANGELOG.md) - [Commits](https://github.com/Yoast/PHPUnit-Polyfills/compare/1.0.4...1.0.5) --- updated-dependencies: - dependency-name: yoast/phpunit-polyfills dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * version bump * update changelogs * add chris and john to contributors * Add cms-platform to CODEOWNERS file (#396) * update date --------- Signed-off-by: dependabot[bot] Co-authored-by: John Spellman Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- CODEOWNERS | 2 +- README.md | 450 +++++++++++++++++++++++++------------------------- composer.lock | 72 ++++---- readme.txt | 10 +- wp-redis.php | 2 +- 5 files changed, 272 insertions(+), 264 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index c6d16d4..6ed271b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1 @@ -* @pantheon-systems/cms-ecosystem +* @pantheon-systems/cms-platform @pantheon-systems/cms-ecosystem diff --git a/README.md b/README.md index e74ce84..4de93e0 100644 --- a/README.md +++ b/README.md @@ -1,223 +1,227 @@ -# WP Redis # -[![Actively Maintained](https://img.shields.io/badge/Pantheon-Actively_Maintained-yellow?logo=pantheon&color=FFDC28)](https://pantheon.io/docs/oss-support-levels#actively-maintained) - -**Contributors:** [getpantheon](https://profiles.wordpress.org/getpantheon), [danielbachhuber](https://profiles.wordpress.org/danielbachhuber), [mboynes](https://profiles.wordpress.org/mboynes), [Outlandish Josh](https://profiles.wordpress.org/Outlandish Josh) -**Tags:** cache, plugin, redis -**Requires at least:** 3.0.1 -**Tested up to:** 6.1.1 -**Stable tag:** 1.3.4 -**License:** GPLv2 or later -**License URI:** http://www.gnu.org/licenses/gpl-2.0.html - -Back your WP Object Cache with Redis, a high-performance in-memory storage backend. - -## Description ## - -[![Travis CI](https://travis-ci.org/pantheon-systems/wp-redis.svg?branch=master)](https://travis-ci.org/pantheon-systems/wp-redis) [![CircleCI](https://circleci.com/gh/pantheon-systems/wp-redis/tree/master.svg?style=svg)](https://circleci.com/gh/pantheon-systems/wp-redis/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. You also need something that can scale across multiple instances of your application, so using local file caches or APC are out. - -Redis is a great answer, and one we bundle on the Pantheon platform. This is our plugin for integrating with the cache, but you can use it on any self-hosted WordPress site if you have Redis. Install from [WordPress.org](https://wordpress.org/plugins/wp-redis/) or [Github](https://github.com/pantheon-systems/wp-redis). - -It's important to note that a persistent object cache isn't a panacea - a page load with 2,000 Redis calls can be 2 full seconds of object cache transactions. Make sure you use the object cache wisely: keep to a sensible number of keys, don't store a huge amount of data on each key, and avoid stampeding frontend writes and deletes. - -Go forth and make awesome! And, once you've built something great, [send us feature requests (or bug reports)](https://github.com/pantheon-systems/wp-redis/issues). Take a look at the wiki for [useful code snippets and other tips](https://github.com/pantheon-systems/wp-redis/wiki). - -## Installation ## - -This assumes you have a PHP environment with the [required PhpRedis extension](https://github.com/phpredis/phpredis) and a working Redis server (e.g. Pantheon). WP Redis also works with Predis via [humanmade/wp-redis-predis-client](https://github.com/humanmade/wp-redis-predis-client). - -1. Install `object-cache.php` to `wp-content/object-cache.php` with a symlink or by copying the file. -2. If you're not running on Pantheon, edit wp-config.php to add your cache credentials, e.g.: - - $redis_server = array( - 'host' => '127.0.0.1', - 'port' => 6379, - 'auth' => '12345', - 'database' => 0, // Optionally use a specific numeric Redis database. Default is 0. - ); - -3. If your Redis server is listening through a sockt file instead, set its path on `host` parameter and change the port to `null`: - - $redis_server = array( - 'host' => '/path/of/redis/socket-file.sock', - 'port' => null, - 'auth' => '12345', - 'database' => 0, // Optionally use a specific numeric Redis database. Default is 0. - ); - -4. Engage thrusters: you are now backing WP's Object Cache with Redis. -5. (Optional) To use the `wp redis` WP-CLI commands, activate the WP Redis plugin. No activation is necessary if you're solely using the object cache drop-in. -6. (Optional) To use the same Redis server with multiple, discreet WordPress installs, you can use the `WP_CACHE_KEY_SALT` constant to define a unique salt for each install. -7. (Optional) To use true cache groups, with the ability to delete all keys for a given group, register groups with `wp_cache_add_redis_hash_groups()`, or define the `WP_REDIS_USE_CACHE_GROUPS` constant to `true` to enable with all groups. However, when enabled, the expiration value is not respected because expiration on group keys isn't a feature [supported by Redis](https://github.com/redis/redis/issues/6620). -8. (Optional) On an existing site previously using WordPress' transient cache, use WP-CLI to delete all (`%_transient_%`) transients from the options table: `wp transient delete-all`. WP Redis assumes responsibility for the transient cache. -9. (Optional) To use [Relay](https://relaycache.com) instead of PhpRedis as the client define the `WP_REDIS_USE_RELAY` constant to `true`. For support requests, please use [Relay's GitHub discussions](https://github.com/cachewerk/relay/discussions). - -## WP-CLI Commands ## - -This plugin implements a variety of [WP-CLI](https://wp-cli.org) commands. All commands are grouped into the `wp redis` namespace. - - $ wp help redis - - NAME - - wp redis - - SYNOPSIS - - wp redis - - SUBCOMMANDS - - cli Launch redis-cli using Redis configuration for WordPress - debug Debug object cache hit / miss ratio for any page URL. - enable Enable WP Redis by creating the symlink for object-cache.php - info Provide details on the Redis connection. - -Use `wp help redis ` to learn more about each command. - -## Contributing ## - -See [CONTRIBUTING.md](https://github.com/pantheon-systems/wp-redis/blob/master/CONTRIBUTING.md) for information on contributing. - -## Frequently Asked Questions ## - -### Why would I want to use this plugin? ### - -If you are concerned with the speed of your site, backing it with a high-performance, persistent object cache can have a huge impact. It takes load off your database, and is faster for loading all the data objects WordPress needs to run. - -### How does this work with other caching plugins? ### - -This plugin is for the internal application object cache. It doesn't have anything to do with page caches. On Pantheon you do not need additional page caching, but if you are self-hosted you can use your favorite page cache plugins in conjunction with WP Redis. - -### How do I disable the persistent object cache for a bad actor? ### - -A page load with 2,000 Redis calls can be 2 full seonds of object cache transactions. If a plugin you're using is erroneously creating a huge number of cache keys, you might be able to mitigate the problem by disabling cache persistency for the plugin's group: - - wp_cache_add_non_persistent_groups( array( 'bad-actor' ) ); - -This declaration means use of `wp_cache_set( 'foo', 'bar', 'bad-actor' );` and `wp_cache_get( 'foo', 'bad-actor' );` will not use Redis, and instead fall back to WordPress' default runtime object cache. - -### Why does the object cache sometimes get out of sync with the database? ### - -There's a known issue with WordPress `alloptions` cache design. Specifically, a race condition between two requests can cause the object cache to have stale values. If you think you might be impacted by this, [review this GitHub issue](https://github.com/pantheon-systems/wp-redis/issues/221) for links to more context, including a workaround. - -## Changelog ## - -### 1.3.4 (March 7, 2023) ### -* Set `missing_redis_message` if Redis service is not connected [[#391](https://github.com/pantheon-systems/wp-redis/pull/391)]. - -### 1.3.3 (February 28, 2023) ### -* Add PHP 8.2 support [[#388](https://github.com/pantheon-systems/wp-redis/pull/388)]. -* Remove Grunt, add valid license to Composer file [[#387](https://github.com/pantheon-systems/wp-redis/pull/387)]. -* Update Composer dependencies [[#384](https://github.com/pantheon-systems/wp-redis/pull/384)] [[#385](https://github.com/pantheon-systems/wp-redis/pull/385)]. - -### 1.3.2 (December 5, 2022) ### -* Fix broken `wp_cache_supports` function [[#382](https://github.com/pantheon-systems/wp-redis/pull/382)]. - -### 1.3.1 (December 2, 2022) ### -* Declare `wp_cache_supports` function and support features. [[#378](https://github.com/pantheon-systems/wp-redis/pull/378)] -* Make dependabot target `develop` branch for PRs. [[#376](https://github.com/pantheon-systems/wp-redis/pull/376)] - -Declare `wp_cache_supports` function and support features. [[#378](https://github.com/pantheon-systems/wp-redis/pull/378)] - -### 1.3.0 (November 29, 2022) ### -* Added CONTRIBUTING.MD and GitHub action to automate deployments to wp.org. [[#368](https://github.com/pantheon-systems/wp-redis/pull/368)] - -### 1.2.0 (February 17, 2022) ### -* Adds support for Relay via `WP_REDIS_USE_RELAY` constant [[#344](https://github.com/pantheon-systems/wp-redis/pull/344)]. - -### 1.1.4 (October 21, 2021) ### -* Fixes some faulty logic in `WP_REDIS_IGNORE_GLOBAL_GROUPS` check [[#333](https://github.com/pantheon-systems/wp-redis/pull/333)]. - -### 1.1.3 (October 21, 2021) ### -* Supports a `WP_REDIS_IGNORE_GLOBAL_GROUPS` constant to prevent groups from being added to global caching group [[#331](https://github.com/pantheon-systems/wp-redis/pull/331)]. - -### 1.1.2 (March 24, 2021) ### -* Applies logic used elsewhere to fall back to `$_SERVER` in `wp_redis_get_info()` [[#316](https://github.com/pantheon-systems/wp-redis/pull/316)]. - -### 1.1.1 (August 17, 2020) ### -* Returns cache data in correct order when using `wp_cache_get_multiple()` and internal cache is already primed [[#292](https://github.com/pantheon-systems/wp-redis/pull/292)]. - -### 1.1.0 (July 13, 2020) ### -* Implements `wp_cache_get_multiple()` for WordPress 5.5 [[#287](https://github.com/pantheon-systems/wp-redis/pull/287)]. -* Bails early when connecting to Redis throws an Exception to avoid fatal error [[285](https://github.com/pantheon-systems/wp-redis/pull/285)]. - -### 1.0.1 (April 14, 2020) ### -* Adds support for specifying Redis database number from environment/server variables [[#273](https://github.com/pantheon-systems/wp-redis/pull/273)]. - -### 1.0.0 (March 2, 2020) ### -* Plugin is stable. - -### 0.8.3 (February 24, 2020) ### -* Fixes `wp redis cli` by using `proc_open()` directly, instead of `WP_CLI::launch()` [[#268](https://github.com/pantheon-systems/wp-redis/pull/268)]. - -### 0.8.2 (January 15, 2020) ### -* Catches exceptions when trying to connect to Redis [[#265](https://github.com/pantheon-systems/wp-redis/pull/265)]. - -### 0.8.1 (January 10, 2020) ### -* Adds `WP_REDIS_DEFAULT_EXPIRE_SECONDS` constant to set default cache expire value [[#264](https://github.com/pantheon-systems/wp-redis/pull/264)]. - -### 0.8.0 (January 6, 2020) ### -* Uses `flushdb` instead of `flushAll` to avoid flushing the entire Redis instance [[#259](https://github.com/pantheon-systems/wp-redis/pull/259)]. - -### 0.7.1 (December 14, 2018) ### -* Better support in `wp_cache_init()` for drop-ins like LudicrousDB [[#231](https://github.com/pantheon-systems/wp-redis/pull/231)]. -* Cleans up PHPCS issues. - -### 0.7.0 (August 22, 2017) ### -* Adds filterable connection methods to permit use of Predis. See [humanmade/wp-redis-predis-client](https://github.com/humanmade/wp-redis-predis-client) for more details. - -### 0.6.2 (June 5, 2017) ### -* Bug fix: Preserves null values in internal cache. -* Bug fix: Converts numeric values to their true type when getting. - -### 0.6.1 (February 23, 2017) ### -* Bug fix: correctly passes an empty password to `redis-cli`. -* Variety of improvements to the test suite. - -### 0.6.0 (September 21, 2016) ### -* Introduces three new WP-CLI commands: `wp redis debug` to display cache hit/miss ratio for any URL; `wp redis info` to display high-level Redis statistics; `wp redis enable` to create the `object-cache.php` symlink. -* Permits a Redis database to be defined with `$redis_server['database']`. -* Introduces `wp_cache_add_redis_hash_groups()`, which permits registering specific groups to use Redis hashes, and is more precise than our existing `WP_REDIS_USE_CACHE_GROUPS` constant. - -### 0.5.0 (April 27, 2016) ### - -* Performance boost! Removes redundant `exists` call from `wp_cache_get()`, which easily halves the number of Redis calls. -* Uses `add_action()` and `$wpdb` in a safer manner for compatibility with Batcache, which loads the object cache before aforementioned APIs are available. -* For debugging purposes, tracks number of calls to Redis, and includes breakdown of call types. -* Adds a slew of more explicit test coverage against existing features. -* For consistency with the actual Redis call, calls `del` instead of `delete`. -* Bug fix: If a group isn't persistent, don't ever make an `exists` call against Redis. - -### 0.4.0 (March 23, 2016) ### - -* Introduces `wp redis-cli`, a WP-CLI command to launch redis-cli with WordPress' Redis credentials. -* Bug fix: Ensures fail back mechanism works as expected on multisite, by writing to sitemeta table instead of the active site's options table. -* Bug fix: Uses 'default' as the default cache group, mirroring WordPress core, such that `$wp_object_cache->add( 'foo', 'bar' )` === `wp_cache_add( 'foo', 'bar' )`. - -### 0.3.0 (February 11, 2016) ### - -* Introduces opt-in support for Redis cache groups. Enable with `define( 'WP_REDIS_USE_CACHE_GROUPS', true );`. When enabled, WP Redis persists cache groups in a structured manner, instead of hashing the cache key and group together. -* Uses PHP_CodeSniffer and [WordPress Coding Standards sniffs](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) to ensure WP Redis adheres to WordPress coding standards. -* Bug fix: Permits use of a Unix socket in `$redis_server['host']` by ensuring the supplied `$port` is null. - -### 0.2.2 (November 24, 2015) ### - -* Bug fix: use `INSERT IGNORE INTO` instead of `INSERT INTO` to prevent SQL errors when two concurrent processes attempt to write failback flag at the same time. -* Bug fix: use `E_USER_WARNING` with `trigger_error()`. -* Bug fix: catch Exceptions thrown during authentication to permit failing back to internal object cache. - -### 0.2.1 (November 17, 2015) ### - -* Bug fix: prevent SQL error when `$wpdb->options` isn't yet initialized on multisite. - -### 0.2.0 (November 17, 2015) ### - -* Gracefully fails back to the WordPress object cache when Redis is unavailable or intermittent. Previously, WP Redis would hard fatal. -* Triggers a PHP error if Redis goes away mid-request, for you to monitor in your logs. Attempts one reconnect based on specific error messages. -* Forces a flushAll on Redis when Redis comes back after failing. This behavior can be disabled with the `WP_REDIS_DISABLE_FAILBACK_FLUSH` constant. -* Show an admin notice when Redis is unavailable but is expected to be. - -### 0.1 ### -* Initial commit of working code for the benefit of all. +# WP Redis # +[![Actively Maintained](https://img.shields.io/badge/Pantheon-Actively_Maintained-yellow?logo=pantheon&color=FFDC28)](https://pantheon.io/docs/oss-support-levels#actively-maintained) + +**Contributors:** [getpantheon](https://profiles.wordpress.org/getpantheon), [danielbachhuber](https://profiles.wordpress.org/danielbachhuber), [mboynes](https://profiles.wordpress.org/mboynes), [Outlandish Josh](https://profiles.wordpress.org/outlandish-josh) [jspellman](https://profiles.wordpress.org/jspellman/) [jazzs3quence](https://profiles.wordpress.org/jazzs3quence/) +**Tags:** cache, plugin, redis +**Requires at least:** 3.0.1 +**Tested up to:** 6.2 +**Stable tag:** 1.3.5 +**License:** GPLv2 or later +**License URI:** http://www.gnu.org/licenses/gpl-2.0.html + +Back your WP Object Cache with Redis, a high-performance in-memory storage backend. + +## Description ## + +[![Travis CI](https://travis-ci.org/pantheon-systems/wp-redis.svg?branch=master)](https://travis-ci.org/pantheon-systems/wp-redis) [![CircleCI](https://circleci.com/gh/pantheon-systems/wp-redis/tree/master.svg?style=svg)](https://circleci.com/gh/pantheon-systems/wp-redis/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. You also need something that can scale across multiple instances of your application, so using local file caches or APC are out. + +Redis is a great answer, and one we bundle on the Pantheon platform. This is our plugin for integrating with the cache, but you can use it on any self-hosted WordPress site if you have Redis. Install from [WordPress.org](https://wordpress.org/plugins/wp-redis/) or [Github](https://github.com/pantheon-systems/wp-redis). + +It's important to note that a persistent object cache isn't a panacea - a page load with 2,000 Redis calls can be 2 full seconds of object cache transactions. Make sure you use the object cache wisely: keep to a sensible number of keys, don't store a huge amount of data on each key, and avoid stampeding frontend writes and deletes. + +Go forth and make awesome! And, once you've built something great, [send us feature requests (or bug reports)](https://github.com/pantheon-systems/wp-redis/issues). Take a look at the wiki for [useful code snippets and other tips](https://github.com/pantheon-systems/wp-redis/wiki). + +## Installation ## + +This assumes you have a PHP environment with the [required PhpRedis extension](https://github.com/phpredis/phpredis) and a working Redis server (e.g. Pantheon). WP Redis also works with Predis via [humanmade/wp-redis-predis-client](https://github.com/humanmade/wp-redis-predis-client). + +1. Install `object-cache.php` to `wp-content/object-cache.php` with a symlink or by copying the file. +2. If you're not running on Pantheon, edit wp-config.php to add your cache credentials, e.g.: + + $redis_server = array( + 'host' => '127.0.0.1', + 'port' => 6379, + 'auth' => '12345', + 'database' => 0, // Optionally use a specific numeric Redis database. Default is 0. + ); + +3. If your Redis server is listening through a sockt file instead, set its path on `host` parameter and change the port to `null`: + + $redis_server = array( + 'host' => '/path/of/redis/socket-file.sock', + 'port' => null, + 'auth' => '12345', + 'database' => 0, // Optionally use a specific numeric Redis database. Default is 0. + ); + +4. Engage thrusters: you are now backing WP's Object Cache with Redis. +5. (Optional) To use the `wp redis` WP-CLI commands, activate the WP Redis plugin. No activation is necessary if you're solely using the object cache drop-in. +6. (Optional) To use the same Redis server with multiple, discreet WordPress installs, you can use the `WP_CACHE_KEY_SALT` constant to define a unique salt for each install. +7. (Optional) To use true cache groups, with the ability to delete all keys for a given group, register groups with `wp_cache_add_redis_hash_groups()`, or define the `WP_REDIS_USE_CACHE_GROUPS` constant to `true` to enable with all groups. However, when enabled, the expiration value is not respected because expiration on group keys isn't a feature [supported by Redis](https://github.com/redis/redis/issues/6620). +8. (Optional) On an existing site previously using WordPress' transient cache, use WP-CLI to delete all (`%_transient_%`) transients from the options table: `wp transient delete-all`. WP Redis assumes responsibility for the transient cache. +9. (Optional) To use [Relay](https://relaycache.com) instead of PhpRedis as the client define the `WP_REDIS_USE_RELAY` constant to `true`. For support requests, please use [Relay's GitHub discussions](https://github.com/cachewerk/relay/discussions). + +## WP-CLI Commands ## + +This plugin implements a variety of [WP-CLI](https://wp-cli.org) commands. All commands are grouped into the `wp redis` namespace. + + $ wp help redis + + NAME + + wp redis + + SYNOPSIS + + wp redis + + SUBCOMMANDS + + cli Launch redis-cli using Redis configuration for WordPress + debug Debug object cache hit / miss ratio for any page URL. + enable Enable WP Redis by creating the symlink for object-cache.php + info Provide details on the Redis connection. + +Use `wp help redis ` to learn more about each command. + +## Contributing ## + +See [CONTRIBUTING.md](https://github.com/pantheon-systems/wp-redis/blob/master/CONTRIBUTING.md) for information on contributing. + +## Frequently Asked Questions ## + +### Why would I want to use this plugin? ### + +If you are concerned with the speed of your site, backing it with a high-performance, persistent object cache can have a huge impact. It takes load off your database, and is faster for loading all the data objects WordPress needs to run. + +### How does this work with other caching plugins? ### + +This plugin is for the internal application object cache. It doesn't have anything to do with page caches. On Pantheon you do not need additional page caching, but if you are self-hosted you can use your favorite page cache plugins in conjunction with WP Redis. + +### How do I disable the persistent object cache for a bad actor? ### + +A page load with 2,000 Redis calls can be 2 full seonds of object cache transactions. If a plugin you're using is erroneously creating a huge number of cache keys, you might be able to mitigate the problem by disabling cache persistency for the plugin's group: + + wp_cache_add_non_persistent_groups( array( 'bad-actor' ) ); + +This declaration means use of `wp_cache_set( 'foo', 'bar', 'bad-actor' );` and `wp_cache_get( 'foo', 'bad-actor' );` will not use Redis, and instead fall back to WordPress' default runtime object cache. + +### Why does the object cache sometimes get out of sync with the database? ### + +There's a known issue with WordPress `alloptions` cache design. Specifically, a race condition between two requests can cause the object cache to have stale values. If you think you might be impacted by this, [review this GitHub issue](https://github.com/pantheon-systems/wp-redis/issues/221) for links to more context, including a workaround. + +## Changelog ## +### 1.3.5 (April 6, 2023) ### +* Bump tested up to version to 6.2 +* Update Composer dependencies [[#394](https://github.com/pantheon-systems/wp-redis/pull/394)] + +### 1.3.4 (March 7, 2023) ### +* Set `missing_redis_message` if Redis service is not connected [[#391](https://github.com/pantheon-systems/wp-redis/pull/391)] + + +### 1.3.3 (February 28, 2023) ### +* Add PHP 8.2 support [[#388](https://github.com/pantheon-systems/wp-redis/pull/388)] +* Remove Grunt, add valid license to Composer file [[#387](https://github.com/pantheon-systems/wp-redis/pull/387)] +* Update Composer dependencies [[#384](https://github.com/pantheon-systems/wp-redis/pull/384)] [[#385](https://github.com/pantheon-systems/wp-redis/pull/385)] + +### 1.3.2 (December 5, 2022) ### +* Fix broken `wp_cache_supports` function [[#382](https://github.com/pantheon-systems/wp-redis/pull/382)]. + +### 1.3.1 (December 2, 2022) ### +* Declare `wp_cache_supports` function and support features. [[#378](https://github.com/pantheon-systems/wp-redis/pull/378)] +* Make dependabot target `develop` branch for PRs. [[#376](https://github.com/pantheon-systems/wp-redis/pull/376)] + +Declare `wp_cache_supports` function and support features. [[#378](https://github.com/pantheon-systems/wp-redis/pull/378)] + +### 1.3.0 (November 29, 2022) ### +* Added CONTRIBUTING.MD and GitHub action to automate deployments to wp.org. [[#368](https://github.com/pantheon-systems/wp-redis/pull/368)] + +### 1.2.0 (February 17, 2022) ### +* Adds support for Relay via `WP_REDIS_USE_RELAY` constant [[#344](https://github.com/pantheon-systems/wp-redis/pull/344)]. + +### 1.1.4 (October 21, 2021) ### +* Fixes some faulty logic in `WP_REDIS_IGNORE_GLOBAL_GROUPS` check [[#333](https://github.com/pantheon-systems/wp-redis/pull/333)]. + +### 1.1.3 (October 21, 2021) ### +* Supports a `WP_REDIS_IGNORE_GLOBAL_GROUPS` constant to prevent groups from being added to global caching group [[#331](https://github.com/pantheon-systems/wp-redis/pull/331)]. + +### 1.1.2 (March 24, 2021) ### +* Applies logic used elsewhere to fall back to `$_SERVER` in `wp_redis_get_info()` [[#316](https://github.com/pantheon-systems/wp-redis/pull/316)]. + +### 1.1.1 (August 17, 2020) ### +* Returns cache data in correct order when using `wp_cache_get_multiple()` and internal cache is already primed [[#292](https://github.com/pantheon-systems/wp-redis/pull/292)]. + +### 1.1.0 (July 13, 2020) ### +* Implements `wp_cache_get_multiple()` for WordPress 5.5 [[#287](https://github.com/pantheon-systems/wp-redis/pull/287)]. +* Bails early when connecting to Redis throws an Exception to avoid fatal error [[285](https://github.com/pantheon-systems/wp-redis/pull/285)]. + +### 1.0.1 (April 14, 2020) ### +* Adds support for specifying Redis database number from environment/server variables [[#273](https://github.com/pantheon-systems/wp-redis/pull/273)]. + +### 1.0.0 (March 2, 2020) ### +* Plugin is stable. + +### 0.8.3 (February 24, 2020) ### +* Fixes `wp redis cli` by using `proc_open()` directly, instead of `WP_CLI::launch()` [[#268](https://github.com/pantheon-systems/wp-redis/pull/268)]. + +### 0.8.2 (January 15, 2020) ### +* Catches exceptions when trying to connect to Redis [[#265](https://github.com/pantheon-systems/wp-redis/pull/265)]. + +### 0.8.1 (January 10, 2020) ### +* Adds `WP_REDIS_DEFAULT_EXPIRE_SECONDS` constant to set default cache expire value [[#264](https://github.com/pantheon-systems/wp-redis/pull/264)]. + +### 0.8.0 (January 6, 2020) ### +* Uses `flushdb` instead of `flushAll` to avoid flushing the entire Redis instance [[#259](https://github.com/pantheon-systems/wp-redis/pull/259)]. + +### 0.7.1 (December 14, 2018) ### +* Better support in `wp_cache_init()` for drop-ins like LudicrousDB [[#231](https://github.com/pantheon-systems/wp-redis/pull/231)]. +* Cleans up PHPCS issues. + +### 0.7.0 (August 22, 2017) ### +* Adds filterable connection methods to permit use of Predis. See [humanmade/wp-redis-predis-client](https://github.com/humanmade/wp-redis-predis-client) for more details. + +### 0.6.2 (June 5, 2017) ### +* Bug fix: Preserves null values in internal cache. +* Bug fix: Converts numeric values to their true type when getting. + +### 0.6.1 (February 23, 2017) ### +* Bug fix: correctly passes an empty password to `redis-cli`. +* Variety of improvements to the test suite. + +### 0.6.0 (September 21, 2016) ### +* Introduces three new WP-CLI commands: `wp redis debug` to display cache hit/miss ratio for any URL; `wp redis info` to display high-level Redis statistics; `wp redis enable` to create the `object-cache.php` symlink. +* Permits a Redis database to be defined with `$redis_server['database']`. +* Introduces `wp_cache_add_redis_hash_groups()`, which permits registering specific groups to use Redis hashes, and is more precise than our existing `WP_REDIS_USE_CACHE_GROUPS` constant. + +### 0.5.0 (April 27, 2016) ### + +* Performance boost! Removes redundant `exists` call from `wp_cache_get()`, which easily halves the number of Redis calls. +* Uses `add_action()` and `$wpdb` in a safer manner for compatibility with Batcache, which loads the object cache before aforementioned APIs are available. +* For debugging purposes, tracks number of calls to Redis, and includes breakdown of call types. +* Adds a slew of more explicit test coverage against existing features. +* For consistency with the actual Redis call, calls `del` instead of `delete`. +* Bug fix: If a group isn't persistent, don't ever make an `exists` call against Redis. + +### 0.4.0 (March 23, 2016) ### + +* Introduces `wp redis-cli`, a WP-CLI command to launch redis-cli with WordPress' Redis credentials. +* Bug fix: Ensures fail back mechanism works as expected on multisite, by writing to sitemeta table instead of the active site's options table. +* Bug fix: Uses 'default' as the default cache group, mirroring WordPress core, such that `$wp_object_cache->add( 'foo', 'bar' )` === `wp_cache_add( 'foo', 'bar' )`. + +### 0.3.0 (February 11, 2016) ### + +* Introduces opt-in support for Redis cache groups. Enable with `define( 'WP_REDIS_USE_CACHE_GROUPS', true );`. When enabled, WP Redis persists cache groups in a structured manner, instead of hashing the cache key and group together. +* Uses PHP_CodeSniffer and [WordPress Coding Standards sniffs](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) to ensure WP Redis adheres to WordPress coding standards. +* Bug fix: Permits use of a Unix socket in `$redis_server['host']` by ensuring the supplied `$port` is null. + +### 0.2.2 (November 24, 2015) ### + +* Bug fix: use `INSERT IGNORE INTO` instead of `INSERT INTO` to prevent SQL errors when two concurrent processes attempt to write failback flag at the same time. +* Bug fix: use `E_USER_WARNING` with `trigger_error()`. +* Bug fix: catch Exceptions thrown during authentication to permit failing back to internal object cache. + +### 0.2.1 (November 17, 2015) ### + +* Bug fix: prevent SQL error when `$wpdb->options` isn't yet initialized on multisite. + +### 0.2.0 (November 17, 2015) ### + +* Gracefully fails back to the WordPress object cache when Redis is unavailable or intermittent. Previously, WP Redis would hard fatal. +* Triggers a PHP error if Redis goes away mid-request, for you to monitor in your logs. Attempts one reconnect based on specific error messages. +* Forces a flushAll on Redis when Redis comes back after failing. This behavior can be disabled with the `WP_REDIS_DISABLE_FAILBACK_FLUSH` constant. +* Show an admin notice when Redis is unavailable but is expected to be. + +### 0.1 ### +* Initial commit of working code for the benefit of all. diff --git a/composer.lock b/composer.lock index a8a2446..bd947c3 100644 --- a/composer.lock +++ b/composer.lock @@ -972,16 +972,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -1019,7 +1019,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -1027,20 +1027,20 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.3", + "version": "v4.15.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", "shasum": "" }, "require": { @@ -1081,9 +1081,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" }, - "time": "2023-01-16T22:05:37+00:00" + "time": "2023-03-05T19:49:14+00:00" }, { "name": "pantheon-systems/pantheon-wordpress-upstream-tests", @@ -1436,16 +1436,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.25", + "version": "9.2.26", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954" + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e2b40518197a8c0d4b08bc34dfff1c99c508954", - "reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", "shasum": "" }, "require": { @@ -1467,8 +1467,8 @@ "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { @@ -1501,7 +1501,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.25" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" }, "funding": [ { @@ -1509,7 +1509,7 @@ "type": "github" } ], - "time": "2023-02-25T05:32:00+00:00" + "time": "2023-03-06T12:58:08+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1754,16 +1754,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.4", + "version": "9.6.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d" + "reference": "b65d59a059d3004a040c16a82e07bbdf6cfdd115" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9125ee085b6d95e78277dc07aa1f46f9e0607b8d", - "reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b65d59a059d3004a040c16a82e07bbdf6cfdd115", + "reference": "b65d59a059d3004a040c16a82e07bbdf6cfdd115", "shasum": "" }, "require": { @@ -1796,8 +1796,8 @@ "sebastian/version": "^3.0.2" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "bin": [ "phpunit" @@ -1836,7 +1836,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.4" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.6" }, "funding": [ { @@ -1852,7 +1853,7 @@ "type": "tidelift" } ], - "time": "2023-02-27T13:06:37+00:00" + "time": "2023-03-27T11:43:46+00:00" }, { "name": "psr/container", @@ -5094,16 +5095,16 @@ }, { "name": "yoast/phpunit-polyfills", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", - "reference": "3c621ff5429d2b1ff96dc5808ad6cde99d31ea4c" + "reference": "3b59adeef77fb1c03ff5381dbb9d68b0aaff3171" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/3c621ff5429d2b1ff96dc5808ad6cde99d31ea4c", - "reference": "3c621ff5429d2b1ff96dc5808ad6cde99d31ea4c", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/3b59adeef77fb1c03ff5381dbb9d68b0aaff3171", + "reference": "3b59adeef77fb1c03ff5381dbb9d68b0aaff3171", "shasum": "" }, "require": { @@ -5111,13 +5112,12 @@ "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "require-dev": { - "yoast/yoastcs": "^2.2.1" + "yoast/yoastcs": "^2.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.x-dev", - "dev-develop": "1.x-dev" + "dev-main": "2.x-dev" } }, "autoload": { @@ -5151,7 +5151,7 @@ "issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues", "source": "https://github.com/Yoast/PHPUnit-Polyfills" }, - "time": "2022-11-16T09:07:52+00:00" + "time": "2023-03-30T23:39:05+00:00" } ], "aliases": [ diff --git a/readme.txt b/readme.txt index 8506893..8119e09 100644 --- a/readme.txt +++ b/readme.txt @@ -1,9 +1,9 @@ === WP Redis === -Contributors: getpantheon, danielbachhuber, mboynes, Outlandish Josh +Contributors: getpantheon, danielbachhuber, mboynes, Outlandish Josh, jspellman, jazzs3quence Tags: cache, plugin, redis Requires at least: 3.0.1 -Tested up to: 6.1.1 -Stable tag: 1.3.4 +Tested up to: 6.2 +Stable tag: 1.3.5 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -102,6 +102,10 @@ There's a known issue with WordPress `alloptions` cache design. Specifically, a == Changelog == += 1.3.5 (April 6, 2023) = +* Bump tested up to version to 6.2 +* Update Composer dependencies [[#394](https://github.com/pantheon-systems/wp-redis/pull/394)] + = 1.3.4 (March 7, 2023) = * Set `missing_redis_message` if Redis service is not connected [[#391](https://github.com/pantheon-systems/wp-redis/pull/391)]. diff --git a/wp-redis.php b/wp-redis.php index ab077ba..b5d0252 100644 --- a/wp-redis.php +++ b/wp-redis.php @@ -3,7 +3,7 @@ * Plugin Name: WP Redis * Plugin URI: http://github.com/pantheon-systems/wp-redis/ * Description: WordPress Object Cache using Redis. Requires the PhpRedis extension (https://github.com/phpredis/phpredis). - * Version: 1.3.4 + * Version: 1.3.5 * Author: Pantheon, Josh Koenig, Matthew Boynes, Daniel Bachhuber, Alley Interactive * Author URI: https://pantheon.io/ */