Author: orbiter
Date: 2006-03-14 00:06:06 +0100 (Tue, 14 Mar 2006)
New Revision: 1884
Modified:
trunk/htroot/PerformanceQueues_p.html
trunk/source/de/anomic/plasma/plasmaWordIndexCache.java
Log:
update to cache flush method
Modified: trunk/htroot/PerformanceQueues_p.html
===================================================================
--- trunk/htroot/PerformanceQueues_p.html 2006-03-13 20:12:31 UTC (rev
1883)
+++ trunk/htroot/PerformanceQueues_p.html 2006-03-13 23:06:06 UTC (rev
1884)
@@ -66,7 +66,7 @@
</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">
Modified: trunk/source/de/anomic/plasma/plasmaWordIndexCache.java
===================================================================
--- trunk/source/de/anomic/plasma/plasmaWordIndexCache.java 2006-03-13
20:12:31 UTC (rev 1883)
+++ trunk/source/de/anomic/plasma/plasmaWordIndexCache.java 2006-03-13
23:06:06 UTC (rev 1884)
@@ -62,7 +62,6 @@
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 second
public static final long kCacheMaxAge = 1000 * 60 * 2; //
milliseconds; 2 minutes
// class variables
@@ -318,9 +317,9 @@
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 wCacheMinAge
return hash;
}
long oldestTime = longEmit(hashDate.getMinScore());
@@ -329,17 +328,13 @@
// flush out-dated entries
return 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 case
hash = (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;
}
_______________________________________________
YaCy-svn mailing list
[email protected]
http://lists.berlios.de/mailman/listinfo/yacy-svn