Skip to content

Commit

Permalink
Introduce WP_REDIS_DISABLE_GROUP_FLUSH to disable group flushing
Browse files Browse the repository at this point in the history
  • Loading branch information
yatsukhnenko committed Jun 3, 2024
1 parent 00bd8a2 commit 24a37c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ The Redis Object Cache plugin comes with vast set of configuration options. If y
| `WP_REDIS_DISABLE_BANNERS` | `false` | Disables promotional banners |
| `WP_REDIS_DISABLE_DROPIN_CHECK` | `false` | Disables the extended drop-in write test |
| `WP_REDIS_DISABLE_DROPIN_AUTOUPDATE` | `false` | Disables the drop-in auto-update |
| `WP_REDIS_DISABLE_GROUP_FLUSH` | `false` | Disables group flushing with Lua script and uses `flushdb` call instead |
| `WP_REDIS_SSL_CONTEXT` | `[]` | TLS connection options for `tls` or `rediss` scheme |

</details>
Expand Down
4 changes: 4 additions & 0 deletions includes/object-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -1768,6 +1768,10 @@ public function flush() {
* @return bool Returns TRUE on success or FALSE on failure.
*/
public function flush_group( $group ) {
if ( defined( 'WP_REDIS_DISABLE_GROUP_FLUSH' ) && WP_REDIS_DISABLE_GROUP_FLUSH ) {
return $this->flush();
}

$san_group = $this->sanitize_key_part( $group );

if ( is_multisite() && ! $this->is_global_group( $san_group ) ) {
Expand Down

0 comments on commit 24a37c3

Please sign in to comment.