summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2019-08-14 10:48:54 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2019-08-14 10:48:54 +0200
commit757606ffa7cbfa210d358d3ac765b55c4818f5ed (patch)
tree4a56acde3e6f78e1dde310b359546b51c1a6b72c
parent2e65887552be0da15c1f7b276a8aaa810521260b (diff)
cache: improve cache management
Change-Id: I2a95154e728bf87976280b52ae0214664b107fd6 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/cache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cache.c b/src/cache.c
index 299d952..3b98c1e 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -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)