Class PersistentDiskCache
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.spi.persistence.persistentcache.AbstractPersistentCache
-
- org.apache.jackrabbit.oak.segment.remote.persistentcache.PersistentDiskCache
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,PersistentCache
public class PersistentDiskCache extends AbstractPersistentCache
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_MAX_CACHE_SIZE_MB
static long
DEFAULT_TEMP_FILES_CLEANUP_WAIT_TIME_MS
static java.lang.String
NAME
-
Fields inherited from class org.apache.jackrabbit.oak.segment.spi.persistence.persistentcache.AbstractPersistentCache
cacheSize, executor, nextCache, segmentCacheStats, THREADS, writesPending
-
-
Constructor Summary
Constructors Constructor Description PersistentDiskCache(java.io.File directory, int cacheMaxSizeMB, IOMonitor diskCacheIOMonitor)
PersistentDiskCache(java.io.File directory, int cacheMaxSizeMB, IOMonitor diskCacheIOMonitor, long tempFilesCleanupWaitTimeMs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Purges the cache entries according to the implementation policy (e.g.boolean
containsSegment(long msb, long lsb)
Check if the segment exists in the cache.protected Buffer
readSegmentInternal(long msb, long lsb)
Reads the segment from the cache.void
writeSegment(long msb, long lsb, Buffer buffer)
Writes the segment to the cache.-
Methods inherited from class org.apache.jackrabbit.oak.segment.spi.persistence.persistentcache.AbstractPersistentCache
close, getCacheStats, getWritesPending, linkWith, readSegment, recordCacheLoadTimeInternal
-
-
-
-
Field Detail
-
DEFAULT_MAX_CACHE_SIZE_MB
public static final int DEFAULT_MAX_CACHE_SIZE_MB
- See Also:
- Constant Field Values
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
DEFAULT_TEMP_FILES_CLEANUP_WAIT_TIME_MS
public static final long DEFAULT_TEMP_FILES_CLEANUP_WAIT_TIME_MS
- See Also:
- Constant Field Values
-
-
Method Detail
-
readSegmentInternal
protected Buffer readSegmentInternal(long msb, long lsb)
Description copied from class:AbstractPersistentCache
Reads the segment from the cache. If segment is not found, this method does not query next cache that was set withAbstractPersistentCache.linkWith(AbstractPersistentCache)
- Specified by:
readSegmentInternal
in classAbstractPersistentCache
- Parameters:
msb
- the most significant bits of the identifier of the segmentlsb
- the least significant bits of the identifier of the segment- 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:PersistentCache
Check if the segment exists in the cache.- Parameters:
msb
- the most significant bits of the identifier of the segmentlsb
- the least significant bits of the identifier of the segment- Returns:
true
if the segment exists
-
writeSegment
public void writeSegment(long msb, long lsb, Buffer buffer)
Description copied from interface:PersistentCache
Writes the segment to the cache.- 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:PersistentCache
Purges the cache entries according to the implementation policy (e.g. maximum cache size, maximum number of entries, etc.)
-
-