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 theSegmentWriterto 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 classWriterCacheManager.DefaultThis implementation ofWriterCacheManagerreturnsRecordCacheinstances for the string and template cache andCacheinstance for the node cache.static classWriterCacheManager.EmptyThis implementation ofWriterCacheManagerreturns empty caches of size 0.
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_NODE_CACHE_SIZEDefault size of the node deduplication cache.static intDEFAULT_STRING_CACHE_SIZEDefault size of the string cache.static intDEFAULT_TEMPLATE_CACHE_SIZEDefault 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 StringgetNodeCacheOccupancyInfo()Get occupancy information for the node deduplication cache indicating occupancy and evictions per priority.@Nullable CacheStatsMBeangetNodeCacheStats()abstract @NotNull Cache<String,RecordId>getStringCache(int generation)@Nullable CacheStatsMBeangetStringCacheStats()abstract @NotNull Cache<Template,RecordId>getTemplateCache(int generation)@Nullable CacheStatsMBeangetTemplateCacheStats()@NotNull WriterCacheManagerwithAccessTracking(@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
generationandoperation.
-
getTemplateCache
@NotNull public abstract @NotNull Cache<Template,RecordId> getTemplateCache(int generation)
- Parameters:
generation-- Returns:
- cache for template records of the given
generationandoperation.
-
getNodeCache
@NotNull public abstract @NotNull Cache<String,RecordId> getNodeCache(int generation)
- Returns:
- cache for node records of the given
generationandoperation.
-
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
nullif not available.
-
getTemplateCacheStats
@Nullable public @Nullable CacheStatsMBean getTemplateCacheStats()
- Returns:
- statistics for the template cache or
nullif not available.
-
getNodeCacheStats
@Nullable public @Nullable CacheStatsMBean getNodeCacheStats()
- Returns:
- statistics for the node cache or
nullif 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.
-
-