[PATCH] Apply cache locking behaviour to stale cache entries.

Elliot Thomas Elliot.Thomas at bbc.co.uk
Mon Dec 3 12:11:15 UTC 2018


Hello,

This patch applies cache locking behaviour to stale cache entries, so
 in the case where the *_cache_lock directives are used, the same
 locking behaviour is used for stale content as it is for new entries.

Previously, this was only done for new cache entries.
(see: http://mailman.nginx.org/pipermail/nginx/2016-January/049734.html)

This is useful when serving stale content is not permissable but sending
 many requests upstream is undesriable.


This patch exposes the ngx_http_file_cache_lock function; this function
 is then called in ngx_http_upstream if a cache entry has expired.

I have attached two versions of this patch, a "minimal" one that avoids
 changes where not strictly necessary, and a "cleaner" version which is
 more invasive but (in my opinion) cleaner.

Both patches cause no (additional) failures in the nginx test suite.
I tested with as many modules as I could reasonably enable.

Additionally, a colleague will add tests for this new behaviour in a
 follow-up patch.


Regards, Elliot.



-----------------------------
http://www.bbc.co.uk
This e-mail (and any attachments) is confidential and
may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in
error, please delete it from your system.
Do not use, copy or disclose the
information in any way nor act in reliance on it and notify the sender
immediately.
Please note that the BBC monitors e-mails
sent or received.
Further communication will signify your consent to
this.
-----------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proxy-cache-lock-on-stale-cleaner.patch
Type: application/octet-stream
Size: 2709 bytes
Desc: proxy-cache-lock-on-stale-cleaner.patch
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20181203/202c3ce7/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proxy-cache-lock-on-stale-minimal.patch
Type: application/octet-stream
Size: 2207 bytes
Desc: proxy-cache-lock-on-stale-minimal.patch
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20181203/202c3ce7/attachment-0001.obj>


More information about the nginx-devel mailing list