perf(2meet-data-optimizer-hivepress-addon): expire object-cache transients
- with an external object cache, a HivePress timeout entry expires when it records; the value (written before its timeout) after at most a week — a miss only makes HivePress rebuild it. Entries of deleted posts no longer accumulate without end - Verify: HivepressTransientFilterTest TTL test, integration 53, unit 145; dev36 Redis TTL on tmdo_hp_transient keys - PR: PR-099
This commit is contained in:
@@ -21,6 +21,14 @@ if ( ! file_exists( $tmdo_core_bootstrap ) ) {
|
||||
. dirname( __DIR__, 3 ) . '/2meet-data-optimizer'
|
||||
);
|
||||
}
|
||||
// Defined before the core bootstrap (which only adds it when missing) so tests can read the TTL.
|
||||
if ( ! function_exists( 'wp_cache_set' ) ) {
|
||||
function wp_cache_set( $key, $value, $group = '', $ttl = 0 ): bool {
|
||||
$GLOBALS['_wp_cache'][ $group ][ $key ] = $value;
|
||||
$GLOBALS['_wp_cache_ttl'][ $group ][ $key ] = (int) $ttl;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
require_once $tmdo_core_bootstrap;
|
||||
|
||||
// External object cache switch for the transient filter tests (Redis on real sites).
|
||||
|
||||
Reference in New Issue
Block a user