Class WriterCacheManager
java.lang.Object
org.apache.jackrabbit.oak.segment.WriterCacheManager
- Direct Known Subclasses:
WriterCacheManager.Default
,WriterCacheManager.Empty
Instances of this class manage the deduplication caches used by the
SegmentWriter
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 ClassesModifier and TypeClassDescriptionstatic class
This implementation ofWriterCacheManager
returnsRecordCache
instances for the string and template cache andCache
instance for the node cache.static class
This implementation ofWriterCacheManager
returns empty caches of size 0. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Default size of the node deduplication cache.static final int
Default size of the string cache.static final int
Default size of the template cache. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetNodeCache
(int generation) @Nullable String
Get occupancy information for the node deduplication cache indicating occupancy and evictions per priority.@Nullable CacheStatsMBean
getStringCache
(int generation) @Nullable CacheStatsMBean
getTemplateCache
(int generation) @Nullable CacheStatsMBean
@NotNull WriterCacheManager
withAccessTracking
(@NotNull String name, @NotNull StatisticsProvider statisticsProvider) Enable access statistics for this cache.
-
Field Details
-
DEFAULT_STRING_CACHE_SIZE
public static final int DEFAULT_STRING_CACHE_SIZEDefault size of the string cache.- See Also:
-
DEFAULT_TEMPLATE_CACHE_SIZE
public static final int DEFAULT_TEMPLATE_CACHE_SIZEDefault size of the template cache.- See Also:
-
DEFAULT_NODE_CACHE_SIZE
public static final int DEFAULT_NODE_CACHE_SIZEDefault size of the node deduplication cache.- See Also:
-
-
Constructor Details
-
WriterCacheManager
public WriterCacheManager()
-
-
Method Details
-
getStringCache
- Returns:
- cache for string records of the given
generation
andoperation
.
-
getTemplateCache
- Parameters:
generation
-- Returns:
- cache for template records of the given
generation
andoperation
.
-
getNodeCache
- 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
- Returns:
- statistics for the string cache or
null
if not available.
-
getTemplateCacheStats
- Returns:
- statistics for the template cache or
null
if not available.
-
getNodeCacheStats
- Returns:
- statistics for the node cache or
null
if not available.
-
getNodeCacheOccupancyInfo
Get occupancy information for the node deduplication cache indicating occupancy and evictions per priority.- Returns:
- occupancy information for the node deduplication cache.
-