From 1591a55963778407b118bad8b13658d9f0a71ca7 Mon Sep 17 00:00:00 2001 From: orbiter Date: Mon, 21 Aug 2006 01:51:27 +0000 Subject: [PATCH] added object cache miss-cache use for remove method git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2434 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/kelondro/kelondroTree.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/de/anomic/kelondro/kelondroTree.java b/source/de/anomic/kelondro/kelondroTree.java index 395fefb01..ec9790be2 100644 --- a/source/de/anomic/kelondro/kelondroTree.java +++ b/source/de/anomic/kelondro/kelondroTree.java @@ -635,6 +635,12 @@ public class kelondroTree extends kelondroRecords implements kelondroIndex { // Removes the mapping for this key from this map if present (optional operation). public kelondroRow.Entry remove(byte[] key) throws IOException { + + // check with miss cache of object cache + // if we know that the object does not exist, then we don't need to lookup in the file + if ((objectCache != null) && (objectCache.has(key) == -1)) return null; + + // delete from database synchronized(writeSearchObj) { if (objectCache != null) objectCache.remove(key); writeSearchObj.process(key); @@ -644,6 +650,7 @@ public class kelondroTree extends kelondroRecords implements kelondroIndex { remove(result, writeSearchObj.getParent()); return values; } else { + if (objectCache != null) objectCache.hasnot(key); return null; } }