comparison src/http/ngx_http_cache.h @ 5880:78c49e243848

Cache: multiple variants of a resource now can be stored. If a variant stored can't be used to respond to a request, the variant hash is used as a secondary key. Additionally, if we previously switched to a secondary key, while storing a response to cache we check if the variant hash still apply. If not, we switch back to the original key, to handle cases when Vary changes.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 27 Oct 2014 21:14:10 +0300
parents c525c0454aa5
children 2f7e557eab5b
comparison
equal deleted inserted replaced
5879:c525c0454aa5 5880:78c49e243848
63 struct ngx_http_cache_s { 63 struct ngx_http_cache_s {
64 ngx_file_t file; 64 ngx_file_t file;
65 ngx_array_t keys; 65 ngx_array_t keys;
66 uint32_t crc32; 66 uint32_t crc32;
67 u_char key[NGX_HTTP_CACHE_KEY_LEN]; 67 u_char key[NGX_HTTP_CACHE_KEY_LEN];
68 u_char main[NGX_HTTP_CACHE_KEY_LEN];
68 69
69 ngx_file_uniq_t uniq; 70 ngx_file_uniq_t uniq;
70 time_t valid_sec; 71 time_t valid_sec;
71 time_t last_modified; 72 time_t last_modified;
72 time_t date; 73 time_t date;
100 unsigned updated:1; 101 unsigned updated:1;
101 unsigned updating:1; 102 unsigned updating:1;
102 unsigned exists:1; 103 unsigned exists:1;
103 unsigned temp_file:1; 104 unsigned temp_file:1;
104 unsigned reading:1; 105 unsigned reading:1;
106 unsigned secondary:1;
105 }; 107 };
106 108
107 109
108 typedef struct { 110 typedef struct {
109 ngx_uint_t version; 111 ngx_uint_t version;