Class WriterCacheManager
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.WriterCacheManager
-
- Direct Known Subclasses:
WriterCacheManager.Default
,WriterCacheManager.Empty
public abstract class WriterCacheManager extends Object
Instances of this class manage the deduplication caches used by theSegmentWriter
to avoid writing multiple copies of the same record. The caches are striped into generations with one generation per gc cycle. This avoids records old generations being reused.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WriterCacheManager.Default
This implementation ofWriterCacheManager
returnsRecordCache
instances for the string and template cache andCache
instance for the node cache.static class
WriterCacheManager.Empty
This implementation ofWriterCacheManager
returns empty caches of size 0.
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_NODE_CACHE_SIZE
Default size of the node deduplication cache.static int
DEFAULT_STRING_CACHE_SIZE
Default size of the string cache.static int
DEFAULT_TEMPLATE_CACHE_SIZE
Default size of the template cache.
-
Constructor Summary
Constructors Constructor Description WriterCacheManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract @NotNull Cache<String,RecordId>
getNodeCache(int generation)
@Nullable String
getNodeCacheOccupancyInfo()
Get occupancy information for the node deduplication cache indicating occupancy and evictions per priority.@Nullable CacheStatsMBean
getNodeCacheStats()
abstract @NotNull Cache<String,RecordId>
getStringCache(int generation)
@Nullable CacheStatsMBean
getStringCacheStats()
abstract @NotNull Cache<Template,RecordId>
getTemplateCache(int generation)
@Nullable CacheStatsMBean
getTemplateCacheStats()
@NotNull WriterCacheManager
withAccessTracking(@NotNull String name, @NotNull StatisticsProvider statisticsProvider)
Enable access statistics for this cache.
-
-
-
Field Detail
-
DEFAULT_STRING_CACHE_SIZE
public static final int DEFAULT_STRING_CACHE_SIZE
Default size of the string cache.- See Also:
getStringCache(int)
-
DEFAULT_TEMPLATE_CACHE_SIZE
public static final int DEFAULT_TEMPLATE_CACHE_SIZE
Default size of the template cache.- See Also:
getTemplateCache(int)
-
DEFAULT_NODE_CACHE_SIZE
public static final int DEFAULT_NODE_CACHE_SIZE
Default size of the node deduplication cache.- See Also:
getNodeCache(int)
-
-
Method Detail
-
getStringCache
@NotNull public abstract @NotNull Cache<String,RecordId> getStringCache(int generation)
- Returns:
- cache for string records of the given
generation
andoperation
.
-
getTemplateCache
@NotNull public abstract @NotNull Cache<Template,RecordId> getTemplateCache(int generation)
- Parameters:
generation
-- Returns:
- cache for template records of the given
generation
andoperation
.
-
getNodeCache
@NotNull public abstract @NotNull Cache<String,RecordId> getNodeCache(int generation)
- Returns:
- cache for node records of the given
generation
andoperation
.
-
withAccessTracking
@NotNull public @NotNull WriterCacheManager withAccessTracking(@NotNull @NotNull String name, @NotNull @NotNull StatisticsProvider statisticsProvider)
Enable access statistics for this cache. The instance returned by from this method delegates back to this instance and adds access statistics via the passedstatisticsProvider
.- Parameters:
name
-statisticsProvider
-- Returns:
- an instance of this cache with access statistics enabled.
-
getStringCacheStats
@Nullable public @Nullable CacheStatsMBean getStringCacheStats()
- Returns:
- statistics for the string cache or
null
if not available.
-
getTemplateCacheStats
@Nullable public @Nullable CacheStatsMBean getTemplateCacheStats()
- Returns:
- statistics for the template cache or
null
if not available.
-
getNodeCacheStats
@Nullable public @Nullable CacheStatsMBean getNodeCacheStats()
- Returns:
- statistics for the node cache or
null
if not available.
-
getNodeCacheOccupancyInfo
@Nullable public @Nullable String getNodeCacheOccupancyInfo()
Get occupancy information for the node deduplication cache indicating occupancy and evictions per priority.- Returns:
- occupancy information for the node deduplication cache.
-
-