|Reported by:||duck_||Owned by:|
There are some occasions when it may be beneficial to temporarily disable object caching (just adding objects to the cache).
I was doing some testing/profiling of large WXR imports and I noticed calls to wp_cache_add for every single post being imported (from wp_import_post -> get_post -> wp_cache_add). However, for the rest of the import these posts are not queried again making their existence in the cache redundant and using up a lot of memory unnecessarily. See this paste for my quick figures (from $wp_object_cache->stats() and memory_get_peak_usage) from local testing... tl;dr is ~199MB -> ~124MB memory usage for no increase in cache misses when importing 10000 posts.