Skip to content

Conversation

daledupreez
Copy link
Contributor

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 incoming prefetch window, which should be an integer
  • The cache key

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


  • Covered with tests (or have a good reason not to test in description ☝️)
  • [N/A] Tested on mobile (or does not apply)

Changelog entry

  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Comment

Comment

Post merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant