You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jk...@apache.org on 2014/05/26 11:15:45 UTC

svn commit: r1597533 - /httpd/httpd/trunk/modules/cache/cache_util.c

Author: jkaluza
Date: Mon May 26 09:15:44 2014
New Revision: 1597533

URL: http://svn.apache.org/r1597533
Log:
mod_cache: try to use the key of a possible open but stale cache entry
if we have one in cache_try_lock(). PR 50317

Submitted by: Ruediger Pluem

Modified:
    httpd/httpd/trunk/modules/cache/cache_util.c

Modified: httpd/httpd/trunk/modules/cache/cache_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_util.c?rev=1597533&r1=1597532&r2=1597533&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/cache_util.c (original)
+++ httpd/httpd/trunk/modules/cache/cache_util.c Mon May 26 09:15:44 2014
@@ -284,7 +284,25 @@ apr_status_t cache_try_lock(cache_server
 
     /* create the key if it doesn't exist */
     if (!cache->key) {
-        cache_generate_key(r, r->pool, &cache->key);
+        cache_handle_t *h;
+        /*
+         * Try to use the key of a possible open but stale cache
+         * entry if we have one.
+         */
+        if (cache->handle != NULL) {
+            h = cache->handle;
+        }
+        else {
+            h = cache->stale_handle;
+        }
+        if ((h != NULL) &&
+            (h->cache_obj != NULL) &&
+            (h->cache_obj->key != NULL)) {
+            cache->key = apr_pstrdup(r->pool, h->cache_obj->key);
+        }
+        else {
+            cache_generate_key(r, r->pool, &cache->key);
+        }
     }
 
     /* create a hashed filename from the key, and save it for later */