|
|
@ -207,14 +207,17 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
|
|
|
|
// cache settings
|
|
|
|
// cache settings
|
|
|
|
|
|
|
|
|
|
|
|
public int maxURLinWordCache() {
|
|
|
|
public int maxURLinWordCache() {
|
|
|
|
|
|
|
|
if (hashScore.size() == 0) return 0;
|
|
|
|
return hashScore.getMaxScore();
|
|
|
|
return hashScore.getMaxScore();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public long minAgeOfWordCache() {
|
|
|
|
public long minAgeOfWordCache() {
|
|
|
|
|
|
|
|
if (hashDate.size() == 0) return 0;
|
|
|
|
return System.currentTimeMillis() - longEmit(hashDate.getMaxScore());
|
|
|
|
return System.currentTimeMillis() - longEmit(hashDate.getMaxScore());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public long maxAgeOfWordCache() {
|
|
|
|
public long maxAgeOfWordCache() {
|
|
|
|
|
|
|
|
if (hashDate.size() == 0) return 0;
|
|
|
|
return System.currentTimeMillis() - longEmit(hashDate.getMinScore());
|
|
|
|
return System.currentTimeMillis() - longEmit(hashDate.getMinScore());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -345,15 +348,16 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
|
|
|
|
return count;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public synchronized int tryRemoveURLs(String urlHash) {
|
|
|
|
public int tryRemoveURLs(String urlHash) {
|
|
|
|
// this tries to delete an index from the cache that has this
|
|
|
|
// this tries to delete an index from the cache that has this
|
|
|
|
// urlHash assigned. This can only work if the entry is really fresh
|
|
|
|
// urlHash assigned. This can only work if the entry is really fresh
|
|
|
|
// Such entries must be searched in the latest entries
|
|
|
|
// Such entries must be searched in the latest entries
|
|
|
|
|
|
|
|
int delCount = 0;
|
|
|
|
|
|
|
|
synchronized (cache) {
|
|
|
|
Iterator i = hashDate.scores(false);
|
|
|
|
Iterator i = hashDate.scores(false);
|
|
|
|
String wordHash;
|
|
|
|
String wordHash;
|
|
|
|
long t;
|
|
|
|
long t;
|
|
|
|
plasmaWordIndexEntryContainer c;
|
|
|
|
plasmaWordIndexEntryContainer c;
|
|
|
|
int delCount = 0;
|
|
|
|
|
|
|
|
while (i.hasNext()) {
|
|
|
|
while (i.hasNext()) {
|
|
|
|
wordHash = (String) i.next();
|
|
|
|
wordHash = (String) i.next();
|
|
|
|
// check time
|
|
|
|
// check time
|
|
|
@ -363,9 +367,11 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
|
|
|
|
c = (plasmaWordIndexEntryContainer) cache.get(wordHash);
|
|
|
|
c = (plasmaWordIndexEntryContainer) cache.get(wordHash);
|
|
|
|
if (c.remove(urlHash) != null) {
|
|
|
|
if (c.remove(urlHash) != null) {
|
|
|
|
cache.put(wordHash, c);
|
|
|
|
cache.put(wordHash, c);
|
|
|
|
|
|
|
|
hashScore.decScore(wordHash);
|
|
|
|
delCount++;
|
|
|
|
delCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return delCount;
|
|
|
|
return delCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|