Getting cache statistics with mod_cache

December 4th, 2008

The always awesome Paul Querna came up with a cool trick to log cache hits/misses. In your virtual host set the environment variable SetEnv CACHE_MISS 1, then log it using your CustomLog with %{CACHE_MISS}e. It will log as “1″ when it is a miss, or as “-” when it gets hit.

How does it work? To quote Paul:

20:36 < @pquerna> as the setenv command runs in fixup hooks
20:36 < @pquerna> which is after the Quick Handler
20:36 < @pquerna> that mod_cache uses

Mostly just noting here so I don’t forget in the future … Thanks Paul!

Leave a Reply