~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Nginx/http/ngx_http_cache.h

Version: ~ [ nginx-0.8.20 ] ~ [ nginx-0.7.62 ] ~ [ nginx-0.6.39 ] ~

  1 
  2 /*
  3  * Copyright (C) Igor Sysoev
  4  */
  5 
  6 
  7 #ifndef _NGX_HTTP_CACHE_H_INCLUDED_
  8 #define _NGX_HTTP_CACHE_H_INCLUDED_
  9 
 10 
 11 #include <ngx_config.h>
 12 #include <ngx_core.h>
 13 #include <ngx_http.h>
 14 
 15 
 16 #define NGX_HTTP_CACHE_MISS          1
 17 #define NGX_HTTP_CACHE_EXPIRED       2
 18 #define NGX_HTTP_CACHE_STALE         3
 19 #define NGX_HTTP_CACHE_UPDATING      4
 20 #define NGX_HTTP_CACHE_HIT           5
 21 #define NGX_HTTP_CACHE_SCARCE        6
 22 
 23 #define NGX_HTTP_CACHE_KEY_LEN       16
 24 
 25 
 26 typedef struct {
 27     ngx_uint_t                       status;
 28     time_t                           valid;
 29 } ngx_http_cache_valid_t;
 30 
 31 
 32 typedef struct {
 33     ngx_rbtree_node_t                node;
 34     ngx_queue_t                      queue;
 35 
 36     u_char                           key[NGX_HTTP_CACHE_KEY_LEN
 37                                          - sizeof(ngx_rbtree_key_t)];
 38 
 39     unsigned                         count:20;
 40     unsigned                         uses:10;
 41     unsigned                         valid_msec:10;
 42     unsigned                         error:10;
 43     unsigned                         exists:1;
 44     unsigned                         updating:1;
 45                                      /* 12 unused bits */
 46 
 47     ngx_file_uniq_t                  uniq;
 48     time_t                           expire;
 49     time_t                           valid_sec;
 50     size_t                           body_start;
 51     off_t                            length;
 52 } ngx_http_file_cache_node_t;
 53 
 54 
 55 struct ngx_http_cache_s {
 56     ngx_file_t                       file;
 57     ngx_array_t                      keys;
 58     uint32_t                         crc32;
 59     u_char                           key[NGX_HTTP_CACHE_KEY_LEN];
 60 
 61     ngx_file_uniq_t                  uniq;
 62     time_t                           valid_sec;
 63     time_t                           last_modified;
 64     time_t                           date;
 65 
 66     size_t                           header_start;
 67     size_t                           body_start;
 68     off_t                            length;
 69 
 70     ngx_uint_t                       min_uses;
 71     ngx_uint_t                       error;
 72     ngx_uint_t                       valid_msec;
 73 
 74     ngx_buf_t                       *buf;
 75 
 76     ngx_http_file_cache_t           *file_cache;
 77     ngx_http_file_cache_node_t      *node;
 78 
 79     unsigned                         updated:1;
 80     unsigned                         exists:1;
 81     unsigned                         temp_file:1;
 82 };
 83 
 84 
 85 typedef struct {
 86     time_t                           valid_sec;
 87     time_t                           last_modified;
 88     time_t                           date;
 89     uint32_t                         crc32;
 90     u_short                          valid_msec;
 91     u_short                          header_start;
 92     u_short                          body_start;
 93 } ngx_http_file_cache_header_t;
 94 
 95 
 96 typedef struct {
 97     ngx_rbtree_t                     rbtree;
 98     ngx_rbtree_node_t                sentinel;
 99     ngx_queue_t                      queue;
100     ngx_atomic_t                     cold;
101     ngx_atomic_t                     loading;
102     off_t                            size;
103 } ngx_http_file_cache_sh_t;
104 
105 
106 struct ngx_http_file_cache_s {
107     ngx_http_file_cache_sh_t        *sh;
108     ngx_slab_pool_t                 *shpool;
109 
110     ngx_path_t                      *path;
111 
112     off_t                            max_size;
113     size_t                           bsize;
114 
115     time_t                           inactive;
116 
117     ngx_msec_t                       last;
118     ngx_uint_t                       files;
119 
120     ngx_shm_zone_t                  *shm_zone;
121 };
122 
123 
124 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);
126 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);
128 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);
130 time_t ngx_http_file_cache_valid(ngx_array_t *cache_valid, ngx_uint_t status);
131 
132 char *ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
133     void *conf);
134 char *ngx_http_file_cache_valid_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
135     void *conf);
136 
137 extern ngx_str_t  ngx_http_cache_status[];
138 
139 
140 #endif /* _NGX_HTTP_CACHE_H_INCLUDED_ */
141 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.