io.sirix.cache.BufferManagerImpl Maven / Gradle / Ivy
package io.sirix.cache;
import io.sirix.index.name.Names;
import io.sirix.page.KeyValueLeafPage;
import io.sirix.page.PageReference;
import io.sirix.page.RevisionRootPage;
import io.sirix.node.interfaces.Node;
import io.sirix.page.interfaces.Page;
public final class BufferManagerImpl implements BufferManager {
private final PageCache pageCache;
private final RecordPageCache recordPageCache;
private final RevisionRootPageCache revisionRootPageCache;
private final RedBlackTreeNodeCache redBlackTreeNodeCache;
private final NamesCache namesCache;
private final PathSummaryCache pathSummaryCache;
public BufferManagerImpl(int maxPageCacheSize, int maxRecordPageCacheSize,
int maxRevisionRootPageCache, int maxRBTreeNodeCache, int maxNamesCacheSize, int maxPathSummaryCacheSize) {
pageCache = new PageCache(maxPageCacheSize);
recordPageCache = new RecordPageCache(maxRecordPageCacheSize);
revisionRootPageCache = new RevisionRootPageCache(maxRevisionRootPageCache);
redBlackTreeNodeCache = new RedBlackTreeNodeCache(maxRBTreeNodeCache);
namesCache = new NamesCache(maxNamesCacheSize);
pathSummaryCache = new PathSummaryCache(maxPathSummaryCacheSize);
}
@Override
public Cache getPageCache() {
return pageCache;
}
@Override
public Cache getRecordPageCache() {
return recordPageCache;
}
@Override
public Cache getRevisionRootPageCache() {
return revisionRootPageCache;
}
@Override
public Cache getIndexCache() {
return redBlackTreeNodeCache;
}
@Override
public NamesCache getNamesCache() {
return namesCache;
}
@Override
public PathSummaryCache getPathSummaryCache() {
return pathSummaryCache;
}
@Override
public void close() {
}
@Override
public void clearAllCaches() {
pageCache.clear();
recordPageCache.clear();
revisionRootPageCache.clear();
redBlackTreeNodeCache.clear();
namesCache.clear();
pathSummaryCache.clear();
}
}