Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-12-02 08:47:29 +0300
committerIgor Sysoev <igor@sysoev.ru>2003-12-02 08:47:29 +0300
commita7dcbaf4ff0ce7ee3ce0e7d767cf86a25f661849 (patch)
tree9ab7a0d27be8d86d10418eaee2471ce126e75db6 /src/http/ngx_http_cache.c
parent4fc368fa3019e06e0de9acd58b8035751c74e38f (diff)
nginx-0.0.1-2003-12-02-08:47:29 import
Diffstat (limited to 'src/http/ngx_http_cache.c')
-rw-r--r--src/http/ngx_http_cache.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/http/ngx_http_cache.c b/src/http/ngx_http_cache.c
index a36db36a4..83d798258 100644
--- a/src/http/ngx_http_cache.c
+++ b/src/http/ngx_http_cache.c
@@ -47,8 +47,14 @@ ngx_http_cache_t *ngx_http_cache_get(ngx_http_cache_hash_t *hash,
&& c[i].key.len == key->len
&& ngx_rstrncmp(c[i].key.data, key->data, key->len) == 0)
{
+#if 0
+ if (c[i].expired) {
+ ngx_mutex_unlock(&hash->mutex);
+ return (void *) NGX_AGAIN;
+ }
+#endif
+
c[i].refs++;
- ngx_mutex_unlock(&hash->mutex);
if ((!(c[i].notify && (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT)))
&& (ngx_cached_time - c[i].updated >= hash->update))
@@ -56,6 +62,8 @@ ngx_http_cache_t *ngx_http_cache_get(ngx_http_cache_hash_t *hash,
c[i].expired = 1;
}
+ ngx_mutex_unlock(&hash->mutex);
+
if (cleanup) {
cleanup->data.cache.hash = hash;
cleanup->data.cache.cache = &c[i];
@@ -217,6 +225,12 @@ void ngx_http_cache_free(ngx_http_cache_t *cache,
}
+void ngx_http_cache_lock(ngx_http_cache_hash_t *hash, ngx_http_cache_t *cache)
+{
+ ngx_mutex_lock(&hash->mutex);
+}
+
+
void ngx_http_cache_unlock(ngx_http_cache_hash_t *hash,
ngx_http_cache_t *cache, ngx_log_t *log)
{
@@ -234,9 +248,11 @@ void ngx_http_cache_unlock(ngx_http_cache_hash_t *hash,
#if 0
-ngx_add_file_event(ngx_fd_t, ngx_event_handler_pt *handler, void *data)
+ngx_http_cache_add_file_event(ngx_http_cache_hash_t *hash,
+ ngx_http_cache_t *cache)
{
- ngx_event_t *ev;
+ ngx_event_t *ev;
+ ngx_http_cache_event_ctx_t *ctx;
ev = &ngx_cycle->read_events[fd];
ngx_memzero(ev, sizeof(ngx_event_t);
@@ -250,7 +266,7 @@ ngx_add_file_event(ngx_fd_t, ngx_event_handler_pt *handler, void *data)
void ngx_http_cache_invalidate(ngx_event_t *ev)
{
- ngx_http_cache_ctx_t *ctx;
+ ngx_http_cache_event_ctx_t *ctx;
ctx = ev->data;