Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
update to cache flush method
orbitere94b374d5699
diff --git a/htroot/PerformanceQueues_p.html b/htroot/PerformanceQueues_p.htmlindex e3a5df4ea..abc4f0552 100644--- a/htroot/PerformanceQueues_p.html+++ b/htroot/PerformanceQueues_p.html@@ -66,7 +66,7 @@ Changes take effect immediately</td></p><p>-<div class=small><b>Indexing Cache Settings:</b></div>+<div class=small><b>Cache Settings:</b></div><form action="PerformanceQueues_p.html" method="post" enctype="multipart/form-data"><table border="0" cellpadding="5" cellspacing="1" width="100%"><tr valign="top" class="TableHeader">diff --git a/source/de/anomic/plasma/plasmaWordIndexCache.java b/source/de/anomic/plasma/plasmaWordIndexCache.javaindex e228f0f95..c0fab2c2c 100644--- a/source/de/anomic/plasma/plasmaWordIndexCache.java+++ b/source/de/anomic/plasma/plasmaWordIndexCache.java@@ -62,7 +62,6 @@ public final class plasmaWordIndexCache /*implements plasmaWordIndexInterface*/private static final String indexArrayFileName = "indexDump1.array";public static final int wCacheReferenceLimit = 50;public static final long wCacheMaxAge = 1000 * 60 * 60 * 2; // milliseconds; 2 hours- public static final long wCacheMinAge = 1000; // milliseconds; 1 secondpublic static final long kCacheMaxAge = 1000 * 60 * 2; // milliseconds; 2 minutes// class variables@@ -318,9 +317,9 @@ public final class plasmaWordIndexCache /*implements plasmaWordIndexInterface*/String hash = null;int count = hashScore.getMaxScore();if ((count > wCacheReferenceLimit) &&- ((hash = (String) hashScore.getMaxObject()) != null) &&- (System.currentTimeMillis() - longEmit(hashDate.getScore(hash)) > wCacheMinAge)) {- // flush high-score entries, but not if they are too 'young'+ ((hash = (String) hashScore.getMaxObject()) != null)) {+ // we MUST flush high-score entries, because a loop deletes entries in cache until this condition fails+ // in this cache we MUST NOT check wCacheMinAgereturn hash;}long oldestTime = longEmit(hashDate.getMinScore());@@ -329,17 +328,13 @@ public final class plasmaWordIndexCache /*implements plasmaWordIndexInterface*/// flush out-dated entriesreturn hash;}- // not an urgent case- if (Runtime.getRuntime().freeMemory() < 10000000) {- // low-memory case+ // cases with respect to memory situation+ if (Runtime.getRuntime().freeMemory() < 1000000) {+ // urgent low-memory casehash = (String) hashScore.getMaxObject(); // flush high-score entries (saves RAM)- if (System.currentTimeMillis() - longEmit(hashDate.getScore(hash)) < wCacheMinAge) {- // to young, take it from the oldest entries- hash = (String) hashDate.getMinObject();- }} else {- // not-efficient-so-far case- hash = (String) hashDate.getMinObject(); // flush oldest entries (makes indexing faster)+ // not-efficient-so-far case. cleans up unnecessary cache slots+ hash = (String) hashDate.getMinObject(); // flush oldest entries}return hash;}