comparison src/http/ngx_http_cache.h @ 469:2ff194b74f1e release-0.1.9

nginx-0.1.9-RELEASE import *) Bugfix: the proxied request was sent without arguments if the request contains "//", "/./", "/../" or "%XX". *) Bugfix: the large compressed responses may be transferred not completely. *) Bugfix: the files bigger than 2G was not transferred on Linux that does not support sendfile64(). *) Bugfix: while the build configuration on Linux the --with-poll_module parameter was required; the bug had appeared in 0.1.8.
author Igor Sysoev <igor@sysoev.ru>
date Thu, 25 Nov 2004 16:17:31 +0000
parents 42d11f017717
children 8e8f3af115b5
comparison
equal deleted inserted replaced
468:1a67596d0349 469:2ff194b74f1e
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 /* 16 /*
17 * The 7 uses before an allocation. 17 * The 3 bits allows the 7 uses before the cache entry allocation.
18 * We can use maximum 7 bits, i.e up to the 127 uses. 18 * We can use maximum 7 bits, i.e up to the 127 uses.
19 */ 19 */
20 #define NGX_HTTP_CACHE_LAZY_ALLOCATION_BITS 3 20 #define NGX_HTTP_CACHE_LAZY_ALLOCATION_BITS 3
21
21 22
22 typedef struct { 23 typedef struct {
23 uint32_t crc; 24 uint32_t crc;
24 ngx_str_t key; 25 ngx_str_t key;
25 time_t accessed; 26 time_t accessed;
43 44
44 union { 45 union {
45 off_t size; 46 off_t size;
46 ngx_str_t value; 47 ngx_str_t value;
47 } data; 48 } data;
48 } ngx_http_cache_t; 49 } ngx_http_cache_entry_t;
49 50
50 51
51 typedef struct { 52 typedef struct {
52 time_t expires; 53 time_t expires;
53 time_t last_modified; 54 time_t last_modified;
60 61
61 #define NGX_HTTP_CACHE_HASH 7 62 #define NGX_HTTP_CACHE_HASH 7
62 #define NGX_HTTP_CACHE_NELTS 4 63 #define NGX_HTTP_CACHE_NELTS 4
63 64
64 typedef struct { 65 typedef struct {
65 ngx_http_cache_t *elts; 66 ngx_http_cache_entry_t *elts;
66 size_t hash; 67 size_t hash;
67 size_t nelts; 68 size_t nelts;
68 time_t life; 69 time_t life;
69 time_t update; 70 time_t update;
70 #if (NGX_THREADS) 71 #if (NGX_THREADS)
74 } ngx_http_cache_hash_t; 75 } ngx_http_cache_hash_t;
75 76
76 77
77 typedef struct { 78 typedef struct {
78 ngx_http_cache_hash_t *hash; 79 ngx_http_cache_hash_t *hash;
79 ngx_http_cache_t *cache; 80 ngx_http_cache_entry_t *cache;
80 ngx_file_t file; 81 ngx_file_t file;
81 ngx_str_t key; 82 ngx_array_t key;
82 uint32_t crc; 83 uint32_t crc;
83 u_char md5[16]; 84 u_char md5[16];
84 ngx_path_t *path; 85 ngx_path_t *path;
85 ngx_buf_t *buf; 86 ngx_buf_t *buf;
86 time_t expires; 87 time_t expires;
88 time_t date; 89 time_t date;
89 off_t length; 90 off_t length;
90 ssize_t header_size; 91 ssize_t header_size;
91 size_t file_start; 92 size_t file_start;
92 ngx_log_t *log; 93 ngx_log_t *log;
93 } ngx_http_cache_ctx_t; 94
95 /* STUB */
96 ngx_str_t key0;
97 } ngx_http_cache_t;
94 98
95 99
96 100
97 #define NGX_HTTP_CACHE_STALE 1 101 #define NGX_HTTP_CACHE_STALE 1
98 #define NGX_HTTP_CACHE_AGED 2 102 #define NGX_HTTP_CACHE_AGED 2
99 #define NGX_HTTP_CACHE_THE_SAME 3 103 #define NGX_HTTP_CACHE_THE_SAME 3
100 104
105
106 #if 0
101 107
102 ngx_http_cache_t *ngx_http_cache_get(ngx_http_cache_hash_t *cache, 108 ngx_http_cache_t *ngx_http_cache_get(ngx_http_cache_hash_t *cache,
103 ngx_http_cleanup_t *cleanup, 109 ngx_http_cleanup_t *cleanup,
104 ngx_str_t *key, uint32_t *crc); 110 ngx_str_t *key, uint32_t *crc);
105 111
125 int ngx_garbage_collector_http_cache_handler(ngx_gc_t *gc, ngx_str_t *name, 131 int ngx_garbage_collector_http_cache_handler(ngx_gc_t *gc, ngx_str_t *name,
126 ngx_dir_t *dir); 132 ngx_dir_t *dir);
127 133
128 char *ngx_http_set_cache_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); 134 char *ngx_http_set_cache_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
129 135
136 #endif
137
130 138
131 #endif /* _NGX_HTTP_CACHE_H_INCLUDED_ */ 139 #endif /* _NGX_HTTP_CACHE_H_INCLUDED_ */