Class DelegatingPersistentCache
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.spi.persistence.persistentcache.DelegatingPersistentCache
-
- All Implemented Interfaces:
PersistentCache
- Direct Known Subclasses:
SegmentPreloader
public abstract class DelegatingPersistentCache extends Object implements PersistentCache
Simple abstract implementation of a delegating PersistentCache that can be used as a base class forPersistentCachedecorators.
-
-
Constructor Summary
Constructors Constructor Description DelegatingPersistentCache()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcleanUp()Purges the cache entries according to the implementation policy (e.g.booleancontainsSegment(long msb, long lsb)Check if the segment exists in the cache.protected abstract PersistentCachedelegate()@Nullable BufferreadSegment(long msb, long lsb, @NotNull Callable<Buffer> loader)Reads the segment from cache.voidwriteSegment(long msb, long lsb, Buffer buffer)Writes the segment to the cache.
-
-
-
Method Detail
-
delegate
protected abstract PersistentCache delegate()
-
readSegment
@Nullable public @Nullable Buffer readSegment(long msb, long lsb, @NotNull @NotNull Callable<Buffer> loader)
Description copied from interface:PersistentCacheReads the segment from cache.- Specified by:
readSegmentin interfacePersistentCache- Parameters:
msb- the most significant bits of the identifier of the segmentlsb- the least significant bits of the identifier of the segmentloader- in case of cache miss, withloader.call()missing element will be retrieved- Returns:
- byte buffer containing the segment data or null if the segment doesn't exist
-
containsSegment
public boolean containsSegment(long msb, long lsb)Description copied from interface:PersistentCacheCheck if the segment exists in the cache.- Specified by:
containsSegmentin interfacePersistentCache- Parameters:
msb- the most significant bits of the identifier of the segmentlsb- the least significant bits of the identifier of the segment- Returns:
trueif the segment exists
-
writeSegment
public void writeSegment(long msb, long lsb, Buffer buffer)Description copied from interface:PersistentCacheWrites the segment to the cache.- Specified by:
writeSegmentin interfacePersistentCache- Parameters:
msb- the most significant bits of the identifier of the segmentlsb- the least significant bits of the identifier of the segmentbuffer- the byte buffer containing the segment data
-
cleanUp
public void cleanUp()
Description copied from interface:PersistentCachePurges the cache entries according to the implementation policy (e.g. maximum cache size, maximum number of entries, etc.)- Specified by:
cleanUpin interfacePersistentCache
-
-