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 long
estimateCurrentWeight()
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.CacheStats
getStats()
static <T> @NotNull RecordCache<T>
newRecordCache(int size)
Factory method for creatingRecordCache
instances.void
put(K key, @NotNull RecordId value, byte cost)
Add a mapping fromkey
tovalue
with a givencost
.abstract long
size()
-
-
-
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:Cache
Add a mapping fromkey
tovalue
with 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 creatingRecordCache
instances. 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
RecordCache
instance 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
RecordCache
instances of the givensize
when 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
RecordCache
instances of the givensize
when invoked. - See Also:
newRecordCache(int)
-
-