Writing a cache module

Akins, Brian Brian.Akins at turner.com
Mon Sep 28 23:06:25 MSD 2009


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

Reading through the upstream code and the proxy and fastcgi modules, it
looks fairly simple.

Just so I know I'm on the right track:

- to get something from cache I should generate a key for r->cache, try to
open file using ngx_http_file_cache_open, then "serve" it using
ngx_http_cache_send (or replicate what it does).

-to store something in cache, create a ngx_temp_file_t store my data in
there, generate a key, then call ngx_http_file_cache_update to add that file
to cache.

Is that reasonable?  Any gotchas?

-- 
Brian Akins






More information about the nginx mailing list