Mercurial > hg > nginx-quic
annotate src/http/ngx_http_cache.h @ 6755:e2f13011343e stable-1.10
HTTP/2: fixed the "http request count is zero" alert.
When the stream is terminated the HEADERS frame can still wait in the output
queue. This frame can't be removed and must be sent to the client anyway,
since HTTP/2 uses stateful compression for headers. So in order to postpone
closing and freeing memory of such stream the special close stream handler
is set to the write event. After the HEADERS frame is sent the write event
is called and the stream will be finally closed.
Some events like receiving a RST_STREAM can trigger the read handler of such
stream in closing state and cause unexpected processing that can result in
another attempt to finalize the request. To prevent it the read handler is
now set to ngx_http_empty_handler.
Thanks to Amazon.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Thu, 16 Jun 2016 20:55:11 +0300 |
parents | c9d680b00744 |
children | e08e741f74cd |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
6 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
7 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #ifndef _NGX_HTTP_CACHE_H_INCLUDED_ |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #define _NGX_HTTP_CACHE_H_INCLUDED_ |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 #include <ngx_config.h> |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
13 #include <ngx_core.h> |
173
4fb2a2cff023
nginx-0.0.1-2003-11-04-20:09:19 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
14 #include <ngx_http.h> |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
16 |
2952 | 17 #define NGX_HTTP_CACHE_MISS 1 |
3699
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3698
diff
changeset
|
18 #define NGX_HTTP_CACHE_BYPASS 2 |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3698
diff
changeset
|
19 #define NGX_HTTP_CACHE_EXPIRED 3 |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3698
diff
changeset
|
20 #define NGX_HTTP_CACHE_STALE 4 |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3698
diff
changeset
|
21 #define NGX_HTTP_CACHE_UPDATING 5 |
5441
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
22 #define NGX_HTTP_CACHE_REVALIDATED 6 |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
23 #define NGX_HTTP_CACHE_HIT 7 |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
24 #define NGX_HTTP_CACHE_SCARCE 8 |
197
0b81c7a0b133
nginx-0.0.1-2003-11-27-10:45:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
25 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
26 #define NGX_HTTP_CACHE_KEY_LEN 16 |
5737
44b9ab7752e3
Cache: ETag now saved into cache header.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5736
diff
changeset
|
27 #define NGX_HTTP_CACHE_ETAG_LEN 42 |
5878
2c89956b6a76
Cache: hash of Vary headers now stored in cache.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5737
diff
changeset
|
28 #define NGX_HTTP_CACHE_VARY_LEN 42 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
190
diff
changeset
|
29 |
5878
2c89956b6a76
Cache: hash of Vary headers now stored in cache.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5737
diff
changeset
|
30 #define NGX_HTTP_CACHE_VERSION 3 |
5736
2fe1967f8854
Cache: version in cache files.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5441
diff
changeset
|
31 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
32 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
33 typedef struct { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
34 ngx_uint_t status; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
35 time_t valid; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
36 } ngx_http_cache_valid_t; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
37 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
38 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
39 typedef struct { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
40 ngx_rbtree_node_t node; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
41 ngx_queue_t queue; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
42 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
43 u_char key[NGX_HTTP_CACHE_KEY_LEN |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
44 - sizeof(ngx_rbtree_key_t)]; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
45 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
46 unsigned count:20; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
47 unsigned uses:10; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
48 unsigned valid_msec:10; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
49 unsigned error:10; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
50 unsigned exists:1; |
2927
55ceaef03d34
proxy_cache_use_stale/fastcgi_cache_use_stale updating
Igor Sysoev <igor@sysoev.ru>
parents:
2926
diff
changeset
|
51 unsigned updating:1; |
3755
76e3a93821b1
fix race condition if during reconfiguration two cache managers try
Igor Sysoev <igor@sysoev.ru>
parents:
3711
diff
changeset
|
52 unsigned deleting:1; |
76e3a93821b1
fix race condition if during reconfiguration two cache managers try
Igor Sysoev <igor@sysoev.ru>
parents:
3711
diff
changeset
|
53 /* 11 unused bits */ |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
54 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
55 ngx_file_uniq_t uniq; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
56 time_t expire; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
57 time_t valid_sec; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
58 size_t body_start; |
3899
e7cd13b7f759
Use more precise stat.st_blocks to account cache size on Unix
Igor Sysoev <igor@sysoev.ru>
parents:
3755
diff
changeset
|
59 off_t fs_size; |
5905
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5880
diff
changeset
|
60 ngx_msec_t lock_time; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
61 } ngx_http_file_cache_node_t; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
62 |
469 | 63 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
64 struct ngx_http_cache_s { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
65 ngx_file_t file; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
66 ngx_array_t keys; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
67 uint32_t crc32; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
68 u_char key[NGX_HTTP_CACHE_KEY_LEN]; |
5880
78c49e243848
Cache: multiple variants of a resource now can be stored.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5879
diff
changeset
|
69 u_char main[NGX_HTTP_CACHE_KEY_LEN]; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
70 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
71 ngx_file_uniq_t uniq; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
72 time_t valid_sec; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
73 time_t last_modified; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
74 time_t date; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
75 |
5737
44b9ab7752e3
Cache: ETag now saved into cache header.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5736
diff
changeset
|
76 ngx_str_t etag; |
5878
2c89956b6a76
Cache: hash of Vary headers now stored in cache.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5737
diff
changeset
|
77 ngx_str_t vary; |
2c89956b6a76
Cache: hash of Vary headers now stored in cache.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5737
diff
changeset
|
78 u_char variant[NGX_HTTP_CACHE_KEY_LEN]; |
5737
44b9ab7752e3
Cache: ETag now saved into cache header.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5736
diff
changeset
|
79 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
80 size_t header_start; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
81 size_t body_start; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
82 off_t length; |
3899
e7cd13b7f759
Use more precise stat.st_blocks to account cache size on Unix
Igor Sysoev <igor@sysoev.ru>
parents:
3755
diff
changeset
|
83 off_t fs_size; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
84 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
85 ngx_uint_t min_uses; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
86 ngx_uint_t error; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
87 ngx_uint_t valid_msec; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
88 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
89 ngx_buf_t *buf; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
90 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
91 ngx_http_file_cache_t *file_cache; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
92 ngx_http_file_cache_node_t *node; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
93 |
6063
d698c300b9ff
Cache: added support for reading of the header in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
5968
diff
changeset
|
94 #if (NGX_THREADS) |
d698c300b9ff
Cache: added support for reading of the header in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
5968
diff
changeset
|
95 ngx_thread_task_t *thread_task; |
d698c300b9ff
Cache: added support for reading of the header in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
5968
diff
changeset
|
96 #endif |
d698c300b9ff
Cache: added support for reading of the header in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
5968
diff
changeset
|
97 |
4385
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3974
diff
changeset
|
98 ngx_msec_t lock_timeout; |
5905
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5880
diff
changeset
|
99 ngx_msec_t lock_age; |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5880
diff
changeset
|
100 ngx_msec_t lock_time; |
4385
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3974
diff
changeset
|
101 ngx_msec_t wait_time; |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3974
diff
changeset
|
102 |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3974
diff
changeset
|
103 ngx_event_t wait_event; |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3974
diff
changeset
|
104 |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3974
diff
changeset
|
105 unsigned lock:1; |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3974
diff
changeset
|
106 unsigned waiting:1; |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3974
diff
changeset
|
107 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
108 unsigned updated:1; |
3711
ce6ba077c270
several changes in cache cleanup handling:
Igor Sysoev <igor@sysoev.ru>
parents:
3699
diff
changeset
|
109 unsigned updating:1; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
110 unsigned exists:1; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
111 unsigned temp_file:1; |
5879
c525c0454aa5
Cache: c->reading flag introduced.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5878
diff
changeset
|
112 unsigned reading:1; |
5880
78c49e243848
Cache: multiple variants of a resource now can be stored.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5879
diff
changeset
|
113 unsigned secondary:1; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
114 }; |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
115 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
116 |
473 | 117 typedef struct { |
5736
2fe1967f8854
Cache: version in cache files.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5441
diff
changeset
|
118 ngx_uint_t version; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
119 time_t valid_sec; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
120 time_t last_modified; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
121 time_t date; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
122 uint32_t crc32; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
123 u_short valid_msec; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
124 u_short header_start; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
125 u_short body_start; |
5737
44b9ab7752e3
Cache: ETag now saved into cache header.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5736
diff
changeset
|
126 u_char etag_len; |
44b9ab7752e3
Cache: ETag now saved into cache header.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5736
diff
changeset
|
127 u_char etag[NGX_HTTP_CACHE_ETAG_LEN]; |
5878
2c89956b6a76
Cache: hash of Vary headers now stored in cache.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5737
diff
changeset
|
128 u_char vary_len; |
2c89956b6a76
Cache: hash of Vary headers now stored in cache.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5737
diff
changeset
|
129 u_char vary[NGX_HTTP_CACHE_VARY_LEN]; |
2c89956b6a76
Cache: hash of Vary headers now stored in cache.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5737
diff
changeset
|
130 u_char variant[NGX_HTTP_CACHE_KEY_LEN]; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
131 } ngx_http_file_cache_header_t; |
477 | 132 |
133 | |
2720
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
134 typedef struct { |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
135 ngx_rbtree_t rbtree; |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
136 ngx_rbtree_node_t sentinel; |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
137 ngx_queue_t queue; |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
138 ngx_atomic_t cold; |
3018 | 139 ngx_atomic_t loading; |
2720
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
140 off_t size; |
6445
c9d680b00744
Cache: added watermark to reduce IO load when keys_zone is full.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6444
diff
changeset
|
141 ngx_uint_t count; |
c9d680b00744
Cache: added watermark to reduce IO load when keys_zone is full.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6444
diff
changeset
|
142 ngx_uint_t watermark; |
2720
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
143 } ngx_http_file_cache_sh_t; |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
144 |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
145 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
146 struct ngx_http_file_cache_s { |
2720
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
147 ngx_http_file_cache_sh_t *sh; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
148 ngx_slab_pool_t *shpool; |
469 | 149 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
150 ngx_path_t *path; |
5968
99639bfdfa2a
Cache: added temp_path to file cache.
Roman Arutyunyan <arut@nginx.com>
parents:
5960
diff
changeset
|
151 ngx_path_t *temp_path; |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
152 |
2616
d19979e0d980
introduce cache manager instead of cache cleaner
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
153 off_t max_size; |
d19979e0d980
introduce cache manager instead of cache cleaner
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
154 size_t bsize; |
d19979e0d980
introduce cache manager instead of cache cleaner
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
155 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
156 time_t inactive; |
2616
d19979e0d980
introduce cache manager instead of cache cleaner
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
157 |
6444
043914d19be8
Cache: report error if slab allocator fails during cache loading.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6063
diff
changeset
|
158 time_t fail_time; |
043914d19be8
Cache: report error if slab allocator fails during cache loading.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6063
diff
changeset
|
159 |
3974
d10bcb07d9d4
loader_files, loader_sleep, and loader_threshold
Igor Sysoev <igor@sysoev.ru>
parents:
3899
diff
changeset
|
160 ngx_uint_t files; |
d10bcb07d9d4
loader_files, loader_sleep, and loader_threshold
Igor Sysoev <igor@sysoev.ru>
parents:
3899
diff
changeset
|
161 ngx_uint_t loader_files; |
2616
d19979e0d980
introduce cache manager instead of cache cleaner
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
162 ngx_msec_t last; |
3974
d10bcb07d9d4
loader_files, loader_sleep, and loader_threshold
Igor Sysoev <igor@sysoev.ru>
parents:
3899
diff
changeset
|
163 ngx_msec_t loader_sleep; |
d10bcb07d9d4
loader_files, loader_sleep, and loader_threshold
Igor Sysoev <igor@sysoev.ru>
parents:
3899
diff
changeset
|
164 ngx_msec_t loader_threshold; |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
165 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
166 ngx_shm_zone_t *shm_zone; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
167 }; |
200
abeaebe0a33c
nginx-0.0.1-2003-11-28-20:41:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
199
diff
changeset
|
168 |
197
0b81c7a0b133
nginx-0.0.1-2003-11-27-10:45:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
169 |
3698
d11227f0107f
rename ngx_http_file_cache_create() to ngx_http_file_cache_new()
Igor Sysoev <igor@sysoev.ru>
parents:
3697
diff
changeset
|
170 ngx_int_t ngx_http_file_cache_new(ngx_http_request_t *r); |
3699
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3698
diff
changeset
|
171 ngx_int_t ngx_http_file_cache_create(ngx_http_request_t *r); |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
172 void ngx_http_file_cache_create_key(ngx_http_request_t *r); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
173 ngx_int_t ngx_http_file_cache_open(ngx_http_request_t *r); |
5959
f7584d7c0ccb
Cache: update variant while setting header.
Valentin Bartenev <vbart@nginx.com>
parents:
5905
diff
changeset
|
174 ngx_int_t ngx_http_file_cache_set_header(ngx_http_request_t *r, u_char *buf); |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
175 void ngx_http_file_cache_update(ngx_http_request_t *r, ngx_temp_file_t *tf); |
5441
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
176 void ngx_http_file_cache_update_header(ngx_http_request_t *r); |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
177 ngx_int_t ngx_http_cache_send(ngx_http_request_t *); |
3711
ce6ba077c270
several changes in cache cleanup handling:
Igor Sysoev <igor@sysoev.ru>
parents:
3699
diff
changeset
|
178 void ngx_http_file_cache_free(ngx_http_cache_t *c, ngx_temp_file_t *tf); |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
179 time_t ngx_http_file_cache_valid(ngx_array_t *cache_valid, ngx_uint_t status); |
199
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
197
diff
changeset
|
180 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
181 char *ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
182 void *conf); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
183 char *ngx_http_file_cache_valid_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
184 void *conf); |
469 | 185 |
3526
62a4fd1e6e2c
proxy_no_cache and fastcgi_no_cache
Igor Sysoev <igor@sysoev.ru>
parents:
3052
diff
changeset
|
186 |
2952 | 187 extern ngx_str_t ngx_http_cache_status[]; |
188 | |
199
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
197
diff
changeset
|
189 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
190 #endif /* _NGX_HTTP_CACHE_H_INCLUDED_ */ |