httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dziugas Baltrunas" <>
Subject mod_cache: MISS or HIT
Date Mon, 12 Feb 2007 08:49:06 GMT
Hi list,

I'm using httpd 2.2.4 as both reverse and forward proxy having caching
enabled with mod_cache.

I'm trying to figure out the way how to put information in access log
(via mod_log_config) whether the request was a cache hit or miss
(similar to what squid does -  TCP_MISS and TCP_HIT). I think this
information is necessary for any proxy server (or acting like it) and
it's always wise to know hit/miss ratio.

Since at least officially mod_cache (and it's sub-modules) does not
export such information, I thought about registering custom
mod_log_config tag (via log_pfn_register). However, looking at the
mod_*_cache source and trying to distinguish cache request from an
ordinary one didn't seem trivial. Just several observations so far:

1. In case it's HIT, output goes over CACHE_OUT, otherwise it's
CACHE_SAVE. Q: is it possible for external module to check (e.g. by
traversing r->output_filters) which filter _was_ used?

2. For mod_file_cache there is a possible "workaround" to rely on
r->clength which is set to match->finfo.size (inside mod_file_cache.c)
in case we have CACHE_OUT. clength seems to be referenced nowhere else
except mod_file_cache.c and http/http_protocol.c where it's set to 0.
However, for mod_mem_cache things are different.


Dziugas Baltrunas

View raw message