0 ? $now + $ttl : PHP_INT_MAX; try { OptionUpdate::change( self::OPTION, static function ( array $keys ) use ( $name, $now, $until ) { foreach ( $keys as $key => $expiry ) { if ( ! is_int( $expiry ) || $expiry < $now ) { unset( $keys[ $key ] ); } } // Concurrent writes with shorter TTLs must not hide a longer-lived key. $keys[ $name ] = max( isset( $keys[ $name ] ) ? $keys[ $name ] : 0, $until ); return $keys; } ); } catch ( \Throwable $e ) { // Caching is optional; never leave an untracked private value behind. delete_transient( $name ); return false; } return $saved; } /** Deletes only registered plugin transients. @return void */ public static function delete_all() { $keys = get_option( self::OPTION, array() ); foreach ( is_array( $keys ) ? array_keys( $keys ) : array() as $name ) { if ( 0 === strpos( $name, 'turtlereport_' ) || 0 === strpos( $name, 'tly_' ) ) { delete_transient( $name ); } } delete_option( self::OPTION ); } }