Package org.aksw.commons.io.slice
Class SliceInMemoryCache<A>
java.lang.Object
org.aksw.commons.io.slice.SliceBase<A>
org.aksw.commons.io.slice.SliceInMemoryCache<A>
- All Implemented Interfaces:
Slice<A>,SliceMetaDataBasic,SliceWithPages<A>,org.aksw.commons.io.util.Sync,PageHelper
A slice implementation that starts to discard pages once there are too many.
- Author:
- raven
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SliceMetaDataWithPagesprotected AsyncClaimingCache<Long,BufferView<A>> Fields inherited from class org.aksw.commons.io.slice.SliceBase
arrayOps, hasDataCondition, readWriteLock -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSliceInMemoryCache(ArrayOps<A> arrayOps, int pageSize, AsyncClaimingCacheImpl.Builder<Long, BufferView<A>> cacheBuilder) -
Method Summary
Modifier and TypeMethodDescriptionaddEvictionGuard(com.google.common.collect.RangeSet<Long> ranges) Protect a set of ranges from eviction.static <A> Slice<A>static <A> SliceInMemory<A>protected voidevictPage(long pageId) protected SliceMetaDataBasicgetPageForPageId(long pageId) longprotected BufferView<A>loadPage(long pageId) voidsync()Methods inherited from class org.aksw.commons.io.slice.SliceBase
getArrayOps, getFailedRanges, getHasDataCondition, getLoadedRanges, getMaximumKnownSize, getMinimumKnownSize, getReadWriteLock, setMaximumKnownSize, setMinimumKnownSizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aksw.commons.util.range.PageHelper
getIndexInPageForOffset, getPageIdForOffset, getPageOffsetForPageIdMethods inherited from interface org.aksw.commons.io.slice.Slice
computeFromMetaData, getArrayOps, getHasDataCondition, getReadWriteLock, isComplete, mutateMetaData, readMetaDataMethods inherited from interface org.aksw.commons.io.slice.SliceMetaDataBasic
getFailedRanges, getGaps, getKnownSize, getLoadedRanges, getMaximumKnownSize, getMinimumKnownSize, setKnownSize, setMaximumKnownSize, setMinimumKnownSize, updateMaximumKnownSize, updateMinimumKnownSizeMethods inherited from interface org.aksw.commons.io.slice.SliceWithPages
newSliceAccessor
-
Field Details
-
metaData
-
pageCache
-
-
Constructor Details
-
SliceInMemoryCache
protected SliceInMemoryCache(ArrayOps<A> arrayOps, int pageSize, AsyncClaimingCacheImpl.Builder<Long, BufferView<A>> cacheBuilder)
-
-
Method Details
-
create
-
evictPage
protected void evictPage(long pageId) -
loadPage
-
create
-
getMetaData
- Specified by:
getMetaDatain classSliceBase<A>
-
sync
- Specified by:
syncin interfaceorg.aksw.commons.io.util.Sync- Throws:
IOException
-
getPageSize
public long getPageSize()- Specified by:
getPageSizein interfacePageHelper- Specified by:
getPageSizein interfaceSliceWithPages<A>
-
getPageForPageId
- Specified by:
getPageForPageIdin interfaceSliceWithPages<A>
-
addEvictionGuard
Description copied from interface:SliceProtect a set of ranges from eviction. If the slice does make use of eviction then this method can return null. Otherwise, a disposable must be returned. As long as it is not disposed no data in the range may get lost due to eviction. This method should not be used directly but via {@link SliceAccessor#addEvictionGuard(RangeSet))}.- Specified by:
addEvictionGuardin interfaceSlice<A>
-