Clear WP object cache periodically on media regenerate/import.#62
Clear WP object cache periodically on media regenerate/import.#62schlessera merged 3 commits intomasterfrom
Conversation
|
Oh... I just looked at how the current cache clearing works, and I think that might potentially produce disasters on a high-traffic production site. For some high-traffic sites, the cache is vital to keep the site online, and a cache invalidation will lead to a cache stampede. If we're forcing such a cache invalidation, without even making that obvious in the documentation or giving people a switch to turn it off, we risk breaking such sites. We will not only mess with the in-memory cache, but also with the persistent (Memcached/Redis/...) cache. I'd like to first investigate whether we cannot just replace the global variable |
|
Good points ta.
That sounds like a great solution, easy to implement and likely to have speed benefits as well. I'll close this PR and create an issue for it on wp-cli/wp-cli. |
Because the underlying utility, |
|
Requesting a second review from @schlessera |
|
I agree that this solves the problem immediately, instead of risking to introduce potential issues through a new mechanism. However, I will keep the idea of a dummy cache object in mind, as it would move the special cache handling logic from multiple different commands in multiple different repositories into one single, isolated location. |
Clear WP object cache periodically on media regenerate/import.
For discussion.
Noticed this old report of memory issues using
wp media regeneratein slack by @dws122 https://wordpress.slack.com/archives/C02RP4T41/p1511409150000032 and thought it might make sense to callwp_clear_object_cache()periodically likewp importandwp exportdo.Testing of
wp media regeneratesuggests it clears around 3 or 4 MB each time, using the same 500 interval aswp import. Testing ofwp media importwas less convincing, but seemed to clear around 1 MB each time.