comparison src/http/ngx_http_upstream.c @ 3697:3c442bd5597b

ngx_http_file_cache_create()
author Igor Sysoev <igor@sysoev.ru>
date Thu, 15 Jul 2010 14:01:02 +0000
parents 045ea40cbfe8
children d11227f0107f
comparison
equal deleted inserted replaced
3696:29fcf794c082 3697:3c442bd5597b
644 644
645 if (r->method & NGX_HTTP_HEAD) { 645 if (r->method & NGX_HTTP_HEAD) {
646 u->method = ngx_http_core_get_method; 646 u->method = ngx_http_core_get_method;
647 } 647 }
648 648
649 c = ngx_pcalloc(r->pool, sizeof(ngx_http_cache_t)); 649 if (ngx_http_file_cache_create(r) != NGX_OK) {
650 if (c == NULL) {
651 return NGX_ERROR; 650 return NGX_ERROR;
652 } 651 }
653
654 if (ngx_array_init(&c->keys, r->pool, 4, sizeof(ngx_str_t)) != NGX_OK) {
655 return NGX_ERROR;
656 }
657
658 r->cache = c;
659 c->file.log = r->connection->log;
660 652
661 if (u->create_key(r) != NGX_OK) { 653 if (u->create_key(r) != NGX_OK) {
662 return NGX_ERROR; 654 return NGX_ERROR;
663 } 655 }
664 656
665 /* TODO: add keys */ 657 /* TODO: add keys */
666 658
667 ngx_http_file_cache_create_key(r); 659 ngx_http_file_cache_create_key(r);
668 660
669 u->cacheable = 1; 661 u->cacheable = 1;
662
663 c = r->cache;
670 664
671 c->min_uses = u->conf->cache_min_uses; 665 c->min_uses = u->conf->cache_min_uses;
672 c->body_start = u->conf->buffer_size; 666 c->body_start = u->conf->buffer_size;
673 c->file_cache = u->conf->cache->data; 667 c->file_cache = u->conf->cache->data;
674 668