Skip to content

Commit 61003da

Browse files
authored
Introduce WP_REDIS_DISABLE_GROUP_FLUSH to disable group flushing (#532)
1 parent 6285077 commit 61003da

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ The Redis Object Cache plugin comes with vast set of configuration options. If y
6161
| `WP_REDIS_DISABLE_BANNERS` | `false` | Disables promotional banners |
6262
| `WP_REDIS_DISABLE_DROPIN_CHECK` | `false` | Disables the extended drop-in write test |
6363
| `WP_REDIS_DISABLE_DROPIN_AUTOUPDATE` | `false` | Disables the drop-in auto-update |
64+
| `WP_REDIS_DISABLE_GROUP_FLUSH` | `false` | Disables group flushing with Lua script and uses `flushdb` call instead |
6465
| `WP_REDIS_SSL_CONTEXT` | `[]` | TLS connection options for `tls` or `rediss` scheme |
6566

6667
</details>

includes/object-cache.php

+4
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,10 @@ public function flush() {
17681768
* @return bool Returns TRUE on success or FALSE on failure.
17691769
*/
17701770
public function flush_group( $group ) {
1771+
if ( defined( 'WP_REDIS_DISABLE_GROUP_FLUSH' ) && WP_REDIS_DISABLE_GROUP_FLUSH ) {
1772+
return $this->flush();
1773+
}
1774+
17711775
$san_group = $this->sanitize_key_part( $group );
17721776

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

0 commit comments

Comments
 (0)