Class WriterCacheManager.Default
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.WriterCacheManager
-
- org.apache.jackrabbit.oak.segment.WriterCacheManager.Default
-
- Enclosing class:
- WriterCacheManager
public static class WriterCacheManager.Default extends WriterCacheManager
This implementation ofWriterCacheManager
returnsRecordCache
instances for the string and template cache andCache
instance for the node cache.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.jackrabbit.oak.segment.WriterCacheManager
WriterCacheManager.Default, WriterCacheManager.Empty
-
-
Field Summary
-
Fields inherited from class org.apache.jackrabbit.oak.segment.WriterCacheManager
DEFAULT_NODE_CACHE_SIZE, DEFAULT_STRING_CACHE_SIZE, DEFAULT_TEMPLATE_CACHE_SIZE
-
-
Constructor Summary
Constructors Constructor Description Default()
New instance using the default factoriesRecordCache.factory(int)
andPriorityCache.factory(int)
with the sizesWriterCacheManager.DEFAULT_STRING_CACHE_SIZE
,WriterCacheManager.DEFAULT_TEMPLATE_CACHE_SIZE
andWriterCacheManager.DEFAULT_NODE_CACHE_SIZE
.Default(@NotNull Supplier<RecordCache<String>> stringCacheFactory, @NotNull Supplier<RecordCache<Template>> templateCacheFactory, @NotNull Supplier<PriorityCache<String,RecordId>> nodeCacheFactory)
New instance using the passed factories for creating cache instances.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> @NotNull Supplier<Long>
accumulateRecordCacheSizes(Iterable<RecordCache<T>> caches)
static <T> @NotNull Supplier<Long>
accumulateRecordCacheWeights(Iterable<RecordCache<T>> caches)
protected void
evictCaches(Predicate<Integer> generations)
Remove all cache generations matching the passedgenerations
predicate.@NotNull Cache<String,RecordId>
getNodeCache(int generation)
@Nullable CacheStatsMBean
getNodeCacheStats()
@NotNull Cache<String,RecordId>
getStringCache(int generation)
@Nullable CacheStatsMBean
getStringCacheStats()
@NotNull Cache<Template,RecordId>
getTemplateCache(int generation)
@Nullable CacheStatsMBean
getTemplateCacheStats()
-
Methods inherited from class org.apache.jackrabbit.oak.segment.WriterCacheManager
getNodeCacheOccupancyInfo, withAccessTracking
-
-
-
-
Constructor Detail
-
Default
public Default(@NotNull @NotNull Supplier<RecordCache<String>> stringCacheFactory, @NotNull @NotNull Supplier<RecordCache<Template>> templateCacheFactory, @NotNull @NotNull Supplier<PriorityCache<String,RecordId>> nodeCacheFactory)
New instance using the passed factories for creating cache instances. The factories will be invoked exactly once when a generation of a cache is requested that has not been requested before.- Parameters:
stringCacheFactory
- factory for the string cachetemplateCacheFactory
- factory for the template cachenodeCacheFactory
- factory for the node cache
-
Default
public Default()
New instance using the default factoriesRecordCache.factory(int)
andPriorityCache.factory(int)
with the sizesWriterCacheManager.DEFAULT_STRING_CACHE_SIZE
,WriterCacheManager.DEFAULT_TEMPLATE_CACHE_SIZE
andWriterCacheManager.DEFAULT_NODE_CACHE_SIZE
.
-
-
Method Detail
-
getStringCache
@NotNull public @NotNull Cache<String,RecordId> getStringCache(int generation)
- Specified by:
getStringCache
in classWriterCacheManager
- Returns:
- cache for string records of the given
generation
andoperation
.
-
getTemplateCache
@NotNull public @NotNull Cache<Template,RecordId> getTemplateCache(int generation)
- Specified by:
getTemplateCache
in classWriterCacheManager
- Returns:
- cache for template records of the given
generation
andoperation
.
-
getNodeCache
@NotNull public @NotNull Cache<String,RecordId> getNodeCache(int generation)
- Specified by:
getNodeCache
in classWriterCacheManager
- Returns:
- cache for node records of the given
generation
andoperation
.
-
getStringCacheStats
@Nullable public @Nullable CacheStatsMBean getStringCacheStats()
- Overrides:
getStringCacheStats
in classWriterCacheManager
- Returns:
- statistics for the string cache or
null
if not available.
-
getTemplateCacheStats
@Nullable public @Nullable CacheStatsMBean getTemplateCacheStats()
- Overrides:
getTemplateCacheStats
in classWriterCacheManager
- Returns:
- statistics for the template cache or
null
if not available.
-
accumulateRecordCacheSizes
@NotNull public static <T> @NotNull Supplier<Long> accumulateRecordCacheSizes(Iterable<RecordCache<T>> caches)
-
accumulateRecordCacheWeights
@NotNull public static <T> @NotNull Supplier<Long> accumulateRecordCacheWeights(Iterable<RecordCache<T>> caches)
-
getNodeCacheStats
@Nullable public @Nullable CacheStatsMBean getNodeCacheStats()
- Overrides:
getNodeCacheStats
in classWriterCacheManager
- Returns:
- statistics for the node cache or
null
if not available.
-
-