Class RecordCache<K>
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.RecordCache<K>
-
-
Constructor Summary
Constructors Constructor Description RecordCache()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract longestimateCurrentWeight()static <T> @NotNull Supplier<RecordCache<T>>factory(int size)static <T> @NotNull Supplier<RecordCache<T>>factory(int size, @NotNull org.apache.jackrabbit.guava.common.cache.Weigher<T,RecordId> weigher)abstract @NotNull org.apache.jackrabbit.guava.common.cache.CacheStatsgetStats()static <T> @NotNull RecordCache<T>newRecordCache(int size)Factory method for creatingRecordCacheinstances.voidput(K key, @NotNull RecordId value, byte cost)Add a mapping fromkeytovaluewith a givencost.abstract longsize()
-
-
-
Method Detail
-
size
public abstract long size()
- Returns:
- number of mappings
-
estimateCurrentWeight
public abstract long estimateCurrentWeight()
-
put
public void put(@NotNull K key, @NotNull @NotNull RecordId value, byte cost)Description copied from interface:CacheAdd a mapping fromkeytovaluewith a givencost.
-
getStats
@NotNull public abstract @NotNull org.apache.jackrabbit.guava.common.cache.CacheStats getStats()
- Returns:
- access statistics for this cache
-
newRecordCache
@NotNull public static <T> @NotNull RecordCache<T> newRecordCache(int size)
Factory method for creatingRecordCacheinstances. The returned instances are all thread safe. They implement a simple LRU behaviour where the least recently accessed mapping would be replaced when inserting a new mapping would exceedsize.- Returns:
- A new
RecordCacheinstance of the givensize.
-
factory
@NotNull public static <T> @NotNull Supplier<RecordCache<T>> factory(int size, @NotNull @NotNull org.apache.jackrabbit.guava.common.cache.Weigher<T,RecordId> weigher)
- Parameters:
size- size of the cacheweigher- Needed to provide an estimation of the cache weight in memory- Returns:
- A factory returning
RecordCacheinstances of the givensizewhen invoked. - See Also:
newRecordCache(int)
-
factory
@NotNull public static <T> @NotNull Supplier<RecordCache<T>> factory(int size)
- Parameters:
size- size of the cache- Returns:
- A factory returning
RecordCacheinstances of the givensizewhen invoked. - See Also:
newRecordCache(int)
-
-