Writing a cache module

Akins, Brian Brian.Akins at turner.com
Mon Sep 28 23:57:20 MSD 2009

On 9/28/09 3:06 PM, "Brian Akins" <Brian.Akins at turner.com> wrote:

> I need to write cache module that's not upstream based.  (Long story...)

Actually maybe someone else has some pointers so I may not have to start
from scratch.

Basically, I need to replicate how apache's mod_cache works (but faster of
course - that's why I'm playing with nginx.)

What it does, is the handler runs really early in the response.  On a cache
hit, it short circuits the filter stack (skipping gzip, ssi, etc.) and
serves to client.

It stores things in cache after most of the filter stack (after, ssi, gzip,

It uses vary. I think in nginx, for my purposes at least, I could just use
configuration to control behavior of the cache key.

Here's a talk from apachecon I did a few years ago to give a hint at what
I'm wanting to do: http://www.akins.org/files/apachecon-cnn-good.pdf

I'm pretty sure I can get equal, and actually better, functionality from
nginx, but just wondering if someone else had attempted it.
Brian Akins

More information about the nginx mailing list