comparison src/http/ngx_http_cache.h @ 635:e67b227c8dbb default tip

Merge with current.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 25 Apr 2011 04:07:55 +0400
parents 6c96fdd2dfc3
children
comparison
equal deleted inserted replaced
578:f3a9e57d2e17 635:e67b227c8dbb
12 #include <ngx_core.h> 12 #include <ngx_core.h>
13 #include <ngx_http.h> 13 #include <ngx_http.h>
14 14
15 15
16 #define NGX_HTTP_CACHE_MISS 1 16 #define NGX_HTTP_CACHE_MISS 1
17 #define NGX_HTTP_CACHE_EXPIRED 2 17 #define NGX_HTTP_CACHE_BYPASS 2
18 #define NGX_HTTP_CACHE_STALE 3 18 #define NGX_HTTP_CACHE_EXPIRED 3
19 #define NGX_HTTP_CACHE_UPDATING 4 19 #define NGX_HTTP_CACHE_STALE 4
20 #define NGX_HTTP_CACHE_HIT 5 20 #define NGX_HTTP_CACHE_UPDATING 5
21 #define NGX_HTTP_CACHE_SCARCE 6 21 #define NGX_HTTP_CACHE_HIT 6
22 #define NGX_HTTP_CACHE_SCARCE 7
22 23
23 #define NGX_HTTP_CACHE_KEY_LEN 16 24 #define NGX_HTTP_CACHE_KEY_LEN 16
24 25
25 26
26 typedef struct { 27 typedef struct {
40 unsigned uses:10; 41 unsigned uses:10;
41 unsigned valid_msec:10; 42 unsigned valid_msec:10;
42 unsigned error:10; 43 unsigned error:10;
43 unsigned exists:1; 44 unsigned exists:1;
44 unsigned updating:1; 45 unsigned updating:1;
45 /* 12 unused bits */ 46 unsigned deleting:1;
47 /* 11 unused bits */
46 48
47 ngx_file_uniq_t uniq; 49 ngx_file_uniq_t uniq;
48 time_t expire; 50 time_t expire;
49 time_t valid_sec; 51 time_t valid_sec;
50 size_t body_start; 52 size_t body_start;
75 77
76 ngx_http_file_cache_t *file_cache; 78 ngx_http_file_cache_t *file_cache;
77 ngx_http_file_cache_node_t *node; 79 ngx_http_file_cache_node_t *node;
78 80
79 unsigned updated:1; 81 unsigned updated:1;
82 unsigned updating:1;
80 unsigned exists:1; 83 unsigned exists:1;
81 unsigned temp_file:1; 84 unsigned temp_file:1;
82 }; 85 };
83 86
84 87
119 122
120 ngx_shm_zone_t *shm_zone; 123 ngx_shm_zone_t *shm_zone;
121 }; 124 };
122 125
123 126
127 ngx_int_t ngx_http_file_cache_new(ngx_http_request_t *r);
128 ngx_int_t ngx_http_file_cache_create(ngx_http_request_t *r);
124 void ngx_http_file_cache_create_key(ngx_http_request_t *r); 129 void ngx_http_file_cache_create_key(ngx_http_request_t *r);
125 ngx_int_t ngx_http_file_cache_open(ngx_http_request_t *r); 130 ngx_int_t ngx_http_file_cache_open(ngx_http_request_t *r);
126 void ngx_http_file_cache_set_header(ngx_http_request_t *r, u_char *buf); 131 void ngx_http_file_cache_set_header(ngx_http_request_t *r, u_char *buf);
127 void ngx_http_file_cache_update(ngx_http_request_t *r, ngx_temp_file_t *tf); 132 void ngx_http_file_cache_update(ngx_http_request_t *r, ngx_temp_file_t *tf);
128 ngx_int_t ngx_http_cache_send(ngx_http_request_t *); 133 ngx_int_t ngx_http_cache_send(ngx_http_request_t *);
129 void ngx_http_file_cache_free(ngx_http_request_t *r, ngx_temp_file_t *tf); 134 void ngx_http_file_cache_free(ngx_http_cache_t *c, ngx_temp_file_t *tf);
130 time_t ngx_http_file_cache_valid(ngx_array_t *cache_valid, ngx_uint_t status); 135 time_t ngx_http_file_cache_valid(ngx_array_t *cache_valid, ngx_uint_t status);
131 136
132 char *ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, 137 char *ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
133 void *conf); 138 void *conf);
134 char *ngx_http_file_cache_valid_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, 139 char *ngx_http_file_cache_valid_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
135 void *conf); 140 void *conf);
136 141
142
137 extern ngx_str_t ngx_http_cache_status[]; 143 extern ngx_str_t ngx_http_cache_status[];
138 144
139 145
140 #endif /* _NGX_HTTP_CACHE_H_INCLUDED_ */ 146 #endif /* _NGX_HTTP_CACHE_H_INCLUDED_ */