public abstract class ReaderCache<T> extends Object
Modifier | Constructor and Description |
---|---|
protected |
ReaderCache(long maxWeight,
int averageWeight,
@NotNull String name,
@NotNull Weigher<org.apache.jackrabbit.oak.segment.ReaderCache.CacheKey,T> weigher)
Create a new string cache.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the cache.
|
T |
get(long msb,
long lsb,
int offset,
Function<Integer,T> loader)
Get the value, loading it if necessary.
|
@NotNull org.apache.jackrabbit.oak.cache.CacheStats |
getStats() |
protected abstract boolean |
isSmall(T value)
Determine whether the entry is small, in which case it can be kept in the fast cache.
|
protected ReaderCache(long maxWeight, int averageWeight, @NotNull @NotNull String name, @NotNull @NotNull Weigher<org.apache.jackrabbit.oak.segment.ReaderCache.CacheKey,T> weigher)
maxWeight
- the maximum memory in bytes.averageWeight
- an estimate for the average weight of the elements in the
cache. See CacheLIRS.setAverageMemory(int)
.weigher
- Needed to provide an estimation of the cache weight in memory@NotNull public @NotNull org.apache.jackrabbit.oak.cache.CacheStats getStats()
@NotNull public T get(long msb, long lsb, int offset, Function<Integer,T> loader)
msb
- the msb of the segmentlsb
- the lsb of the segmentoffset
- the offsetloader
- the loader functionpublic void clear()
protected abstract boolean isSmall(T value)
Copyright © 2012–2020 The Apache Software Foundation. All rights reserved.