summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_cache.h
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2016-12-22 14:25:34 +0300
committerRoman Arutyunyan <arut@nginx.com>2016-12-22 14:25:34 +0300
commitda2b2cf1e039630cec84e8b67d99c4d578361b0d (patch)
treeabe94ca9f27fa0322e0fda2ee4922e08e91bcdb9 /src/http/ngx_http_cache.h
parent42f3dd2b843157ea0982b165b69c5dad84095811 (diff)
downloadnginx-da2b2cf1e039630cec84e8b67d99c4d578361b0d.tar.gz
nginx-da2b2cf1e039630cec84e8b67d99c4d578361b0d.tar.bz2
Cache: support for stale-while-revalidate and stale-if-error.
Previously, there was no way to enable the proxy_cache_use_stale behavior by reading the backend response. Now, stale-while-revalidate and stale-if-error Cache-Control extensions (RFC 5861) are supported. They specify, how long a stale response can be used when a cache entry is being updated, or in case of an error.
Diffstat (limited to '')
-rw-r--r--src/http/ngx_http_cache.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/http/ngx_http_cache.h b/src/http/ngx_http_cache.h
index 4075f3dec..d253812f6 100644
--- a/src/http/ngx_http_cache.h
+++ b/src/http/ngx_http_cache.h
@@ -27,7 +27,7 @@
#define NGX_HTTP_CACHE_ETAG_LEN 42
#define NGX_HTTP_CACHE_VARY_LEN 42
-#define NGX_HTTP_CACHE_VERSION 3
+#define NGX_HTTP_CACHE_VERSION 4
typedef struct {
@@ -71,6 +71,8 @@ struct ngx_http_cache_s {
ngx_file_uniq_t uniq;
time_t valid_sec;
+ time_t updating_sec;
+ time_t error_sec;
time_t last_modified;
time_t date;
@@ -114,12 +116,17 @@ struct ngx_http_cache_s {
unsigned purged:1;
unsigned reading:1;
unsigned secondary:1;
+
+ unsigned stale_updating:1;
+ unsigned stale_error:1;
};
typedef struct {
ngx_uint_t version;
time_t valid_sec;
+ time_t updating_sec;
+ time_t error_sec;
time_t last_modified;
time_t date;
uint32_t crc32;