Add cache_calls metric for persistent object cache integration#219
Add cache_calls metric for persistent object cache integration#219Copilot wants to merge 5 commits into
cache_calls metric for persistent object cache integration#219Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
… metric Agent-Logs-Url: https://github.com/wp-cli/profile-command/sessions/d00efdc1-7144-4e26-b76c-880aeca9a768 Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
… feedback Agent-Logs-Url: https://github.com/wp-cli/profile-command/sessions/d00efdc1-7144-4e26-b76c-880aeca9a768 Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
redis_calls metric for persistent object cache integration
|
@copilot address the review comments |
…ct cache backends Agent-Logs-Url: https://github.com/wp-cli/profile-command/sessions/96870b9d-2d37-4ac3-b192-b5d30a51d5fe Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Done in 20c95b9. Two changes made:
|
redis_calls metric for persistent object cache integrationcache_calls metric for persistent object cache integration
|
@copilot fix failing tests. apparently |
Agent-Logs-Url: https://github.com/wp-cli/profile-command/sessions/06c52567-fd1e-4fe3-a0d8-53c22f5c8e8b Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Fixed in e13fa72. Added an |
Multiple persistent object cache plugins expose backend call counts, but
wp profilehad no way to surface this data.Changes
src/Logger.php— adds$cache_callspublic property; addsget_object_cache_calls()static helper that reads from whichever backend is active;start()captures the offset,stop()computes and stores the delta. Gracefully no-ops (shows0) when no supported backend is present.src/Profiler.php— adds$tick_cache_calls_offsetfor tick-based (function-level) profiling; mirrors the same offset/delta pattern inhandle_function_tick()via the shared helper.src/Command.php— addscache_callsto the$metricsfields forstage,hook,eval, andeval-filesubcommands.features/profile-eval.feature— two new scenarios: one assertingcache_calls = 0with the default cache; one using a minimalobject-cache.phpdrop-in that mimics thecache_callsarray format to assert the count is correct.Supported backends
The
get_object_cache_calls()helper checks each source in order:$wp_object_cache->redis_calls(array of command → count)$wp_object_cache->cache_calls(array of command → count)$wp_object_cache->metrics()->storeReads + storeWritesExample output