Class WriterCacheManager.Default
java.lang.Object
org.apache.jackrabbit.oak.segment.WriterCacheManager
org.apache.jackrabbit.oak.segment.WriterCacheManager.Default
- Enclosing class:
- WriterCacheManager
This implementation of
WriterCacheManager
returns
RecordCache
instances for the string and template cache
and Cache
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
ConstructorsConstructorDescriptionDefault()
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
Modifier and TypeMethodDescriptionaccumulateRecordCacheSizes
(Iterable<RecordCache<T>> caches) accumulateRecordCacheWeights
(Iterable<RecordCache<T>> caches) protected final void
evictCaches
(Predicate<Integer> generations) Remove all cache generations matching the passedgenerations
predicate.getNodeCache
(int generation) @Nullable CacheStatsMBean
getStringCache
(int generation) @Nullable CacheStatsMBean
getTemplateCache
(int generation) @Nullable CacheStatsMBean
Methods inherited from class org.apache.jackrabbit.oak.segment.WriterCacheManager
getNodeCacheOccupancyInfo, withAccessTracking
-
Constructor Details
-
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 Details
-
getStringCache
- Specified by:
getStringCache
in classWriterCacheManager
- Returns:
- cache for string records of the given
generation
andoperation
.
-
getTemplateCache
- Specified by:
getTemplateCache
in classWriterCacheManager
- Returns:
- cache for template records of the given
generation
andoperation
.
-
getNodeCache
- Specified by:
getNodeCache
in classWriterCacheManager
- Returns:
- cache for node records of the given
generation
andoperation
.
-
getStringCacheStats
- Overrides:
getStringCacheStats
in classWriterCacheManager
- Returns:
- statistics for the string cache or
null
if not available.
-
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
- Overrides:
getNodeCacheStats
in classWriterCacheManager
- Returns:
- statistics for the node cache or
null
if not available.
-
evictCaches
Remove all cache generations matching the passedgenerations
predicate.- Parameters:
generations
-
-