Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

added object cache miss-cache use for remove method

orbiter1591a5596377
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;
}
}