From 912116c5a761fc4b1688fd5ee999af3c9af566e9 Mon Sep 17 00:00:00 2001 From: orbiter Date: Tue, 23 May 2006 20:17:18 +0000 Subject: [PATCH] renew cache update time if a cache-read hit happens git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2135 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/kelondro/kelondroObjectCache.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/de/anomic/kelondro/kelondroObjectCache.java b/source/de/anomic/kelondro/kelondroObjectCache.java index 8cf603e21..3fd2a1ff8 100644 --- a/source/de/anomic/kelondro/kelondroObjectCache.java +++ b/source/de/anomic/kelondro/kelondroObjectCache.java @@ -202,7 +202,11 @@ public class kelondroObjectCache { public Object get(String key) { if (key == null) return null; - Object r = cache.get(key); + Object r = null; + synchronized(cache) { + r = cache.get(key); + ages.setScore(key, intTime(System.currentTimeMillis())); // renew cache update time + } flushc(); if (r == null) this.readMiss++; else this.readHit++; return r; @@ -237,6 +241,7 @@ public class kelondroObjectCache { if (key == null) return 0; synchronized(cache) { if (hasnot.getScore(key) > 0) { + hasnot.setScore(key, intTime(System.currentTimeMillis())); // renew cache update time this.hasnotHit++; return -1; }