Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Nov 23, 2025

Description

While updating the pluggable function list for WP 6.9, I noticed there are now more cache functions in WP.

Based on the docs:

This commit adds these functions to the appropriate lists for the sniff to take into account.

Includes tests.

Suggested changelog entry

WordPress.DB.DirectDatabaseQuery now recognizes more caching functions, like the wp_cache_*_multiple() functions as added in WordPress 6.0 and the wp_cache_*_salted() functions as added in WordPress 6.9.

While updating the pluggable function list for WP 6.9, I noticed there are now more cache functions in WP.

Based on the docs:
* [`wp_cache_get_multiple()`](https://developer.wordpress.org/reference/functions/wp_cache_get_multiple/) was added in WP 5.5.0.
* [`wp_cache_get_multiple_salted()`](https://developer.wordpress.org/reference/functions/wp_cache_get_multiple_salted/) was added in WP 6.9.0.
* [`wp_cache_get_salted()`](https://developer.wordpress.org/reference/functions/wp_cache_get_salted/) was added in WP 6.9.0.
* [`wp_cache_add_multiple()`](https://developer.wordpress.org/reference/functions/wp_cache_add_multiple/) was added in WP 6.0.0.
* [`wp_cache_set_multiple()`](https://developer.wordpress.org/reference/functions/wp_cache_set_multiple/) was added in WP 6.0.0.
* [`wp_cache_set_multiple_salted()`](https://developer.wordpress.org/reference/functions/wp_cache_set_multiple_salted/) was added in WP 6.9.0.
* [`wp_cache_set_salted()`](https://developer.wordpress.org/reference/functions/wp_cache_set_salted/) was added in WP 6.9.0.
* [`wp_cache_delete_multiple()`](https://developer.wordpress.org/reference/functions/wp_cache_delete_multiple/) was added in WP 6.0.0.
* [`wp_cache_flush_group()`](https://developer.wordpress.org/reference/functions/wp_cache_flush_group/) was added in WP 6.1.0.
* [`wp_cache_flush_runtime()`](https://developer.wordpress.org/reference/functions/wp_cache_flush_runtime/) was added in WP 6.0.0.

This commit adds these functions to the appropriate lists for the sniff to take into account.

Includes tests.
@jrfnl jrfnl added this to the 3.3.0 milestone Nov 23, 2025
@jrfnl jrfnl removed this from the 3.3.0 milestone Nov 23, 2025
Copy link
Collaborator

@rodrigoprimo rodrigoprimo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! This PR looks good to me.

I have a non-blocking question. I wonder why you added tests covering 6 of the 10 new functions? Is there a reason not to include (or update an existing test) to ensure that wp_cache_get_salted(), wp_cache_set_salted(), wp_cache_set_multiple(), and wp_cache_flush_runtime() are covered as well?

@jrfnl jrfnl added this to the 3.3.0 milestone Nov 24, 2025
@jrfnl
Copy link
Member Author

jrfnl commented Nov 24, 2025

I wonder why you added tests covering 6 of the 10 new functions? Is there a reason not to include (or update an existing test) to ensure that wp_cache_get_salted(), wp_cache_set_salted(), wp_cache_set_multiple(), and wp_cache_flush_runtime() are covered as well?

Cause those tests wouldn't necessarily add any value. The sniff logic is not touched and already 100% covered.

Aside from that, I also didn't want to spend more time than necessary on this and documentation for some of these functions is currently not available on developer.wordpress.org, so figuring out the params etc would need digging into the WP Core source for no added value to our tests.

@jrfnl
Copy link
Member Author

jrfnl commented Nov 24, 2025

As this has been reviewed in time for the 3.3.0 release, I've added it to the milestone and will merge the PR.

@jrfnl jrfnl merged commit da2054d into develop Nov 24, 2025
40 checks passed
@jrfnl jrfnl deleted the feature/directdatabasequery-update-function-lists branch November 24, 2025 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants