Mercurial > hg > nginx-quic
annotate src/http/ngx_http_cache.h @ 2925:8e3e31fd00a9
remove remnants
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sat, 06 Jun 2009 14:13:49 +0000 |
parents | b3b8c66bd520 |
children | 80a314b63c56 |
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 |
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
|
4 */ |
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 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #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
|
8 #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
|
9 |
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 #include <ngx_config.h> |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 #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
|
13 #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
|
14 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
16 #define NGX_HTTP_CACHE_STALE 1 |
197
0b81c7a0b133
nginx-0.0.1-2003-11-27-10:45:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
17 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
18 #define NGX_HTTP_CACHE_KEY_LEN 16 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
190
diff
changeset
|
19 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
20 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
21 typedef struct { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
22 ngx_uint_t status; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
23 time_t valid; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
24 } ngx_http_cache_valid_t; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
25 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
26 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
27 typedef struct { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
28 ngx_rbtree_node_t node; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
29 ngx_queue_t queue; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
30 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
31 u_char key[NGX_HTTP_CACHE_KEY_LEN |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
32 - sizeof(ngx_rbtree_key_t)]; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
33 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
34 unsigned count:20; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
35 unsigned uses:10; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
36 unsigned valid_msec:10; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
37 unsigned error:10; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
38 unsigned exists:1; |
2925 | 39 /* 13 unused bits */ |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
40 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
41 ngx_file_uniq_t uniq; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
42 time_t expire; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
43 time_t valid_sec; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
44 size_t body_start; |
2616
d19979e0d980
introduce cache manager instead of cache cleaner
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
45 off_t length; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
46 } ngx_http_file_cache_node_t; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
47 |
469 | 48 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
49 struct ngx_http_cache_s { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
50 ngx_file_t file; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
51 ngx_array_t keys; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
52 uint32_t crc32; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
53 u_char key[NGX_HTTP_CACHE_KEY_LEN]; |
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 valid_sec; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
57 time_t last_modified; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
58 time_t date; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
59 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
60 size_t header_start; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
61 size_t body_start; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
62 off_t length; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
63 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
64 ngx_uint_t min_uses; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
65 ngx_uint_t uses; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
66 ngx_uint_t error; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
67 ngx_uint_t valid_msec; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
68 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
69 ngx_buf_t *buf; |
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_http_file_cache_t *file_cache; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
72 ngx_http_file_cache_node_t *node; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
73 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
74 unsigned updated:1; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
75 unsigned exists:1; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
76 unsigned temp_file:1; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
77 }; |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
78 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
79 |
473 | 80 typedef struct { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
81 time_t valid_sec; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
82 time_t last_modified; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
83 time_t date; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
84 uint32_t crc32; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
85 u_short valid_msec; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
86 u_short header_start; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
87 u_short body_start; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
88 } ngx_http_file_cache_header_t; |
477 | 89 |
90 | |
2720
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
91 typedef struct { |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
92 ngx_rbtree_t rbtree; |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
93 ngx_rbtree_node_t sentinel; |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
94 ngx_queue_t queue; |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
95 ngx_atomic_t cold; |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
96 off_t size; |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
97 } ngx_http_file_cache_sh_t; |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
98 |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2616
diff
changeset
|
99 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
100 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
|
101 ngx_http_file_cache_sh_t *sh; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
102 ngx_slab_pool_t *shpool; |
469 | 103 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
104 ngx_path_t *path; |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
105 |
2616
d19979e0d980
introduce cache manager instead of cache cleaner
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
106 off_t max_size; |
d19979e0d980
introduce cache manager instead of cache cleaner
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
107 size_t bsize; |
d19979e0d980
introduce cache manager instead of cache cleaner
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
108 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
109 time_t inactive; |
2616
d19979e0d980
introduce cache manager instead of cache cleaner
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
110 |
d19979e0d980
introduce cache manager instead of cache cleaner
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
111 ngx_msec_t last; |
d19979e0d980
introduce cache manager instead of cache cleaner
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
112 ngx_uint_t files; |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
113 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
114 ngx_shm_zone_t *shm_zone; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
115 }; |
200
abeaebe0a33c
nginx-0.0.1-2003-11-28-20:41:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
199
diff
changeset
|
116 |
197
0b81c7a0b133
nginx-0.0.1-2003-11-27-10:45:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
117 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
118 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
|
119 ngx_int_t ngx_http_file_cache_open(ngx_http_request_t *r); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
120 void ngx_http_file_cache_set_header(ngx_http_request_t *r, u_char *buf); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
121 void ngx_http_file_cache_update(ngx_http_request_t *r, ngx_temp_file_t *tf); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
122 ngx_int_t ngx_http_cache_send(ngx_http_request_t *); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
123 void ngx_http_file_cache_free(ngx_http_request_t *r, ngx_temp_file_t *tf); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
124 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
|
125 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
126 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
127 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
|
128 void *conf); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
477
diff
changeset
|
129 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
|
130 void *conf); |
469 | 131 |
199
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
197
diff
changeset
|
132 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
133 #endif /* _NGX_HTTP_CACHE_H_INCLUDED_ */ |