# Ngx\_srcache v0.12: new config directives and bug fixes

**URL:** <https://www.ruby-forum.com/t/ngx-srcache-v0-12-new-config-directives-and-bug-fixes/209296>\
**Category:** NGINX\
**Created:** [July 11, 2011, 7:04am UTC](https://www.ruby-forum.com/t/ngx-srcache-v0-12-new-config-directives-and-bug-fixes/209296 "2011-07-11T07:04:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [July 11, 2011, 7:04am UTC](https://www.ruby-forum.com/t/ngx-srcache-v0-12-new-config-directives-and-bug-fixes/209296/1 "2011-07-11T07:04:35Z")

</div>

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:

[http://github.com/agentzh/srcache-nginx-module/downloads](http://github.com/agentzh/srcache-nginx-module/downloads)

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”  
else  
return “”  
end’;

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  
Clyne.

- 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,  
ngx\_redis2.

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:

[GitHub - openresty/srcache-nginx-module: Transparent subrequest-based caching layout for arbitrary nginx locations.](http://github.com/agentzh/srcache-nginx-module)

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

[http://agentzh.org/misc/slides/perl-lz-apps/index.html#23](http://agentzh.org/misc/slides/perl-lz-apps/index.html#23)

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](http://openresty.org)

Enjoy!  
-agentzh
