Igor Sysoev | 6597749 | 2003-11-02 22:56:18 +0000 | [diff] [blame] | 1 | #ifndef _NGX_HTTP_CACHE_H_INCLUDED_ |
| 2 | #define _NGX_HTTP_CACHE_H_INCLUDED_ |
| 3 | |
| 4 | |
| 5 | #include <ngx_config.h> |
| 6 | #include <ngx_core.h> |
Igor Sysoev | f60b1a5 | 2003-11-04 17:09:19 +0000 | [diff] [blame^] | 7 | #include <ngx_http.h> |
Igor Sysoev | 6597749 | 2003-11-02 22:56:18 +0000 | [diff] [blame] | 8 | |
| 9 | |
| 10 | typedef struct { |
| 11 | time_t expires; |
| 12 | time_t last_modified; |
Igor Sysoev | cf80a70 | 2003-11-03 22:20:44 +0000 | [diff] [blame] | 13 | time_t date; |
Igor Sysoev | 6597749 | 2003-11-02 22:56:18 +0000 | [diff] [blame] | 14 | off_t length; |
Igor Sysoev | 6597749 | 2003-11-02 22:56:18 +0000 | [diff] [blame] | 15 | } ngx_http_cache_header_t; |
| 16 | |
| 17 | |
| 18 | typedef struct { |
Igor Sysoev | 6597749 | 2003-11-02 22:56:18 +0000 | [diff] [blame] | 19 | ngx_http_cache_header_t header; |
Igor Sysoev | a1512b1 | 2003-11-03 17:33:31 +0000 | [diff] [blame] | 20 | size_t key_len; |
Igor Sysoev | 6597749 | 2003-11-02 22:56:18 +0000 | [diff] [blame] | 21 | char key[0]; |
Igor Sysoev | a1512b1 | 2003-11-03 17:33:31 +0000 | [diff] [blame] | 22 | } ngx_http_cache_file_t; |
Igor Sysoev | 6597749 | 2003-11-02 22:56:18 +0000 | [diff] [blame] | 23 | |
| 24 | |
| 25 | typedef struct { |
| 26 | u_int32_t crc; |
| 27 | ngx_str_t key; |
| 28 | ngx_fd_t fd; |
| 29 | off_t size; |
| 30 | void *data; /* mmap, memory */ |
| 31 | time_t accessed; |
| 32 | time_t last_modified; |
| 33 | time_t updated; /* no needed with kqueue */ |
| 34 | int refs; |
| 35 | int flags; |
| 36 | } ngx_http_cache_entry_t; |
| 37 | |
| 38 | |
| 39 | typedef struct { |
| 40 | ngx_file_t file; |
| 41 | ngx_str_t key; |
| 42 | ngx_path_t *path; |
| 43 | ngx_hunk_t *buf; |
| 44 | ngx_http_cache_header_t header; |
Igor Sysoev | a1512b1 | 2003-11-03 17:33:31 +0000 | [diff] [blame] | 45 | ssize_t header_size; |
Igor Sysoev | 6597749 | 2003-11-02 22:56:18 +0000 | [diff] [blame] | 46 | } ngx_http_cache_ctx_t; |
| 47 | |
| 48 | |
Igor Sysoev | cf80a70 | 2003-11-03 22:20:44 +0000 | [diff] [blame] | 49 | #define NGX_HTTP_CACHE_STALE 1 |
| 50 | #define NGX_HTTP_CACHE_AGED 2 |
Igor Sysoev | a1512b1 | 2003-11-03 17:33:31 +0000 | [diff] [blame] | 51 | |
| 52 | |
Igor Sysoev | 6597749 | 2003-11-02 22:56:18 +0000 | [diff] [blame] | 53 | int ngx_http_cache_get_file(ngx_http_request_t *r, ngx_http_cache_ctx_t *ctx); |
| 54 | int ngx_http_cache_update_file(ngx_http_request_t *r,ngx_http_cache_ctx_t *ctx, |
| 55 | ngx_str_t *temp_file); |
| 56 | |
| 57 | |
| 58 | |
Igor Sysoev | 6597749 | 2003-11-02 22:56:18 +0000 | [diff] [blame] | 59 | #endif /* _NGX_HTTP_CACHE_H_INCLUDED_ */ |