fix(2meet-data-optimizer-hivepress-addon): with an object cache, keep HivePress transients out of wp_options entirely
- On a cache miss the filter fell back to get_option(): with the values now written to the cache, the option is absent, so WordPress added its name to `notoptions` for good (dev36: +1,000 entries for 1,000 posts, one array loaded on every miss); a hit kept the old row in the options cache group with no expiry, which slowed the selective Redis flush (8.9 s, BUSY). The cache is now the only store for reads and deletes; old rows wait for cleanup-hp-transients --options. Without an object cache nothing changes. - Verify: HivepressTransientFilterTest (2 RED before); dev36 notoptions 210 → 210 over 1,000 posts (was 128 → 1,128) - PR: PR-089c
This commit is contained in:
@@ -167,9 +167,14 @@ final class TMDO_Hivepress_Transient_Filter {
|
||||
// HivePress cache layer reads the timeout *first*, then decides whether
|
||||
// to read the value. We must preserve raw stored values until HivePress
|
||||
// itself orders deletion.
|
||||
$value = wp_using_ext_object_cache() ? wp_cache_get( $option_name, self::CACHE_GROUP ) : false;
|
||||
if ( false === $value ) {
|
||||
// wp_options: where values went before an object cache was used.
|
||||
if ( wp_using_ext_object_cache() ) {
|
||||
// The object cache is the only store. Rows left in wp_options from
|
||||
// before are not read (`wp tmdo cleanup-hp-transients --options`
|
||||
// removes them): a get_option() miss would add the name to
|
||||
// `notoptions` for good, as later writes never reach wp_options.
|
||||
$value = wp_cache_get( $option_name, self::CACHE_GROUP );
|
||||
$value = false === $value ? null : $value;
|
||||
} else {
|
||||
$value = get_option( $option_name, null );
|
||||
}
|
||||
|
||||
@@ -248,6 +253,7 @@ final class TMDO_Hivepress_Transient_Filter {
|
||||
|
||||
if ( wp_using_ext_object_cache() ) {
|
||||
wp_cache_delete( $option_name, self::CACHE_GROUP );
|
||||
return true;
|
||||
}
|
||||
delete_option( $option_name );
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user