MINOR: cache: report the number of cache lookups and cache hits
The cache lookups and hits is now accounted per frontend and per backend,
and reported on the stats page.
diff --git a/src/cache.c b/src/cache.c
index 74743f2..199b865 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1389,6 +1389,11 @@
if (s->txn->flags & TX_CACHE_IGNORE)
return ACT_RET_CONT;
+ if (px == strm_fe(s))
+ HA_ATOMIC_ADD(&px->fe_counters.p.http.cache_lookups, 1);
+ else
+ HA_ATOMIC_ADD(&px->be_counters.p.http.cache_lookups, 1);
+
shctx_lock(shctx_ptr(cache));
res = entry_exist(cache, s->txn->cache_hash);
if (res) {
@@ -1402,6 +1407,11 @@
appctx->ctx.cache.entry = res;
appctx->ctx.cache.next = NULL;
appctx->ctx.cache.sent = 0;
+
+ if (px == strm_fe(s))
+ HA_ATOMIC_ADD(&px->fe_counters.p.http.cache_hits, 1);
+ else
+ HA_ATOMIC_ADD(&px->be_counters.p.http.cache_hits, 1);
return ACT_RET_CONT;
} else {
shctx_lock(shctx_ptr(cache));