Add cache prefetch opt out filter #4680
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to:
Changes proposed in this Pull Request:
This PR adds a filter to allow the default cache prefetch window for supported keys to be overridden by merchants, as suggested by @diegocurbelo in this comment on #4637.
The new filter is
wc_stripe_database_cache_prefetch_window
, and takes two arguments:The filter should return a negative integer or 0 to disable cache prefetching for a specific key. If it returns a positive integer, that will be used as the cache prefetch window. If any other value is returned, we fall back on the default prefetch window defined in
WC_Stripe_Database_Cache_Prefetch::PREFETCH_CONFIG
.The filter is only triggered for supported cache keys that have an entry in
WC_Stripe_Database_Cache_Prefetch::PREFETCH_CONFIG
.Testing instructions
Changelog entry
Changelog Entry Comment
Comment
Post merge