]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
*) Fixed cache-removal order in mod_mem_cache.
authorPaul J. Reder <rederpj@apache.org>
Thu, 5 Feb 2004 19:08:37 +0000 (19:08 +0000)
committerPaul J. Reder <rederpj@apache.org>
Thu, 5 Feb 2004 19:08:37 +0000 (19:08 +0000)
Submitted by: Jean-Jacques Clar, Cliff Woolley
Reviewed by: jwoolley, bnicholes, rederpj

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@102518 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/experimental/cache_cache.c
modules/experimental/mod_mem_cache.c

diff --git a/CHANGES b/CHANGES
index 056721ee2aed67e2840d6bda217610b9da0ec359..f1e5a46779f253bd828d61953a1ac5be9575e3b6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.49
 
+  *) Fixed cache-removal order in mod_mem_cache.
+     [Jean-Jacques Clar, Cliff Woolley]
+
   *) mod_setenvif: Fix the regex optimizer, which under circumstances
      treated the supplied regex as literal string. PR 24219.
      [AndrĂ© Malo]
diff --git a/STATUS b/STATUS
index cdd4e6b76aa114d222706ab1fcf06317806b003f..4c0b8c7933a660d6c8f8732279193bfe479be329 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 APACHE 2.0 STATUS:                                              -*-text-*-
-Last modified at [$Date: 2004/02/05 18:41:58 $]
+Last modified at [$Date: 2004/02/05 19:08:36 $]
 
 Release:
 
@@ -241,11 +241,6 @@ PATCHES TO BACKPORT FROM 2.1
          bnicholes (looks good on Netware but then NetWare does not
                     use shared memory.)
 
-    * Fix mod_mem_cache removal ordering bug.
-        modules/experimental/mod_mem_cache.c r1.97,1.99
-        modules/experimental/cache_cache.c r1.5
-      +1: jwoolley, bnicholes, rederpj
-
     * mod_auth_digest: Allow sub-requests with different methods than the
       original request.  PR 25040.
         modules/aaa/mod_auth_digest.c: r1.82
index 78f26e254f743c323af656b2fc4cef06f4a8db23..6189ec8d5a97a03cf90184b6f8126813c51d86dd 100644 (file)
@@ -161,7 +161,7 @@ CACHE_DECLARE(void) cache_insert(cache_cache_t* c, void *entry)
         /* FIX: If ejected is NULL, we'll segfault here */
         priority = c->get_pri(ejected);
 
-        if (c->queue_clock < priority)
+        if (c->queue_clock > priority)
             c->queue_clock = priority;
 
         cache_hash_set(c->ht,
index bcade9febd87641aceebb27ab20d329f387b48d1..b65680d35c8151e2782630d4d0d3647d276fb966 100644 (file)
@@ -232,20 +232,21 @@ static void memcache_cache_free(void*a)
 #endif
 }
 /*
- * functions return a 'negative' score as lower is better in a priority Q
+ * functions return a 'negative' score since priority queues
+ * dequeue the object with the highest value first
  */
 static long memcache_lru_algorithm(long queue_clock, void *a) 
 {
     cache_object_t *obj = (cache_object_t *)a;
     mem_cache_object_t *mobj = obj->vobj;
     if (mobj->priority == 0)
-        mobj->priority = ((long)(queue_clock + mobj->total_refs));
+        mobj->priority = queue_clock - mobj->total_refs;
 
     /* 
      * a 'proper' LRU function would just be
      *  mobj->priority = mobj->total_refs; 
      */
-    return -1*mobj->priority;
+    return mobj->priority;
 }
 
 static long memcache_gdsf_algorithm(long queue_clock, void *a) 
@@ -254,9 +255,10 @@ static long memcache_gdsf_algorithm(long queue_clock, void *a)
     mem_cache_object_t *mobj = obj->vobj;
 
     if (mobj->priority == 0)
-        mobj->priority = queue_clock + (long)(mobj->total_refs*1000 / mobj->m_len);
+        mobj->priority = queue_clock -
+                           (long)(mobj->total_refs*1000 / mobj->m_len);
 
-    return -1*mobj->priority;
+    return mobj->priority;
 }
 
 static void cleanup_cache_object(cache_object_t *obj)