[ANN] ngx_srcache v0.12: new config directives and bug fixes

agentzh agentzh at gmail.com
Mon Jul 11 09:03:56 MSD 2011

Hi, all!

I'm happy to announce that ngx_srcache v0.12 has just been released.
You can download the release tarball from the download page below:


Special thanks go to Andre (shoki) for contributing a lot for this release :)

Here goes the complete change log:

* now we properly support fetch/store subrequests with internal
redirection in them. main requests with internal redirection will
still not be stored into the cache if there is a cache miss. thanks
Liseen Wan for reporting it.

* fixed spots that trigger the unused-but-set-variable warning by gcc 4.6.

* added srcache_store_skip and srcache_fetch_skip directives to skip
cache fetching or storing based on variables that are set and not
empty nor 0. thanks Andre. Examples of using Lua to set $nocache to
avoid storing URIs that contain /tmp:

   set_by_lua $nocache '
       if string.match(ngx.var.request_uri, "/tmp") then
         return "true"
         return ""

   srcache_store_skip $nocache;

* added new directive srcache_store_max_size. thanks Andre.

* made our filter optimization work with nginx HUP by clearing the
ngx_http_srcache_used flag at nginx pre-config callback. thanks Marcus

* now we skip NULL chains in our output filters and also removed the
SUBREQUEST_IN_MEMORY flag for our srcache_store subrequests because it
will cause mysterious hanging issues when memcached returns
CLIENT_ERROR for "get".

The ngx_srcache module provides a transparent caching layer for
arbitrary nginx locations (like those use an upstream or even serve
static disk files). Usually, the ngx_memc module is used together with
this module to provide a concrete caching storage backend. But
technically, any modules that provide a REST interface can be used as
the fetching and storage subrequests used by ngx_srcache, for example,

For main requests, the srcache_fetch directive works at the end of the
access phase, so the standard access module's "allow" and "deny"
direcives run *before* ours, which is usually the desired behavior for
security reasons.

You can find the complete documentation on the project page hosted on GitHub:


This module has been heavily used in our production environment for
more than a year, as illustrated in the following chart:


Several outside users have also reported success in their production use.

Also, this module is included and enabled by default in our
ngx_openresty bundle: http://openresty.org


More information about the nginx mailing list