cache: improve cache management
authorJosé Bollo <jose.bollo@iot.bzh>
Wed, 14 Aug 2019 08:48:54 +0000 (10:48 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Wed, 14 Aug 2019 08:48:54 +0000 (10:48 +0200)
Change-Id: I2a95154e728bf87976280b52ae0214664b107fd6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/cache.c

index 299d952..3b98c1e 100644 (file)
@@ -107,8 +107,10 @@ drop_lre(
        while (iter < cache->used) {
                item = itemat(cache, iter);
                hit = item->hit;
-               if (hit < hmin)
+               if (hit <= hmin) {
                        found = iter;
+                       hmin = hit;
+               }
                iter += item->length;
        }
        if (found < cache->used)