@ -126,6 +126,21 @@ public final class plasmaWordIndex implements indexRI {
return dhtInCache . size ( ) ;
return dhtInCache . size ( ) ;
}
}
public long dhtCacheSizeBytes ( boolean in ) {
// calculate the real size in bytes of DHT-In/Out-Cache
long cacheBytes = 0 ;
long entryBytes = indexRWIEntry . urlEntryRow . objectsize ( ) ;
indexRAMRI cache = ( in ? dhtInCache : dhtOutCache ) ;
Iterator it = cache . wordContainers ( null , false ) ;
indexContainer ic ;
while ( it . hasNext ( ) ) {
ic = ( indexContainer ) it . next ( ) ;
cacheBytes + = ic . size ( ) * entryBytes ;
}
return cacheBytes ;
}
public void setMaxWordCount ( int maxWords ) {
public void setMaxWordCount ( int maxWords ) {
dhtOutCache . setMaxWordCount ( maxWords ) ;
dhtOutCache . setMaxWordCount ( maxWords ) ;
dhtInCache . setMaxWordCount ( maxWords ) ;
dhtInCache . setMaxWordCount ( maxWords ) ;
@ -520,7 +535,7 @@ public final class plasmaWordIndex implements indexRI {
public synchronized kelondroCloneableIterator wordContainers ( String startWordHash , boolean ram ) {
public synchronized kelondroCloneableIterator wordContainers ( String startWordHash , boolean ram ) {
kelondroOrder containerOrder = new indexContainerOrder ( ( kelondroOrder ) indexOrder . clone ( ) ) ;
kelondroOrder containerOrder = new indexContainerOrder ( ( kelondroOrder ) indexOrder . clone ( ) ) ;
containerOrder . rotate ( startWordHash . getBytes ( ) ) ;
containerOrder . rotate ( startWordHash . getBytes ( ) ) ;
if ( ram ) {
if ( ram ) {
return dhtOutCache . wordContainers ( startWordHash , false ) ;
return dhtOutCache . wordContainers ( startWordHash , false ) ;
} else {
} else {