Class WriterCacheManager

  • Direct Known Subclasses:
    WriterCacheManager.Default, WriterCacheManager.Empty

    public abstract class WriterCacheManager
    extends java.lang.Object
    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.
    • 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)
    • Constructor Detail

      • WriterCacheManager

        public WriterCacheManager()
    • Method Detail

      • getStringCache

        @NotNull
        public abstract @NotNull Cache<java.lang.String,​RecordId> getStringCache​(int generation)
        Returns:
        cache for string records of the given generation and operation.
      • getTemplateCache

        @NotNull
        public abstract @NotNull Cache<Template,​RecordId> getTemplateCache​(int generation)
        Parameters:
        generation -
        Returns:
        cache for template records of the given generation and operation.
      • getNodeCache

        @NotNull
        public abstract @NotNull Cache<java.lang.String,​RecordId> getNodeCache​(int generation)
        Returns:
        cache for node records of the given generation and operation.
      • withAccessTracking

        @NotNull
        public @NotNull WriterCacheManager withAccessTracking​(@NotNull
                                                              @NotNull java.lang.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 passed statisticsProvider.
        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 java.lang.String getNodeCacheOccupancyInfo()
        Get occupancy information for the node deduplication cache indicating occupancy and evictions per priority.
        Returns:
        occupancy information for the node deduplication cache.