public abstract class ReaderCache<T> extends Object
Modifier | Constructor and Description |
---|---|
protected |
ReaderCache(long maxWeight,
int averageWeight,
String name)
Create a new string cache.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the cache.
|
T |
get(long msb,
long lsb,
int offset,
com.google.common.base.Function<Integer,T> loader)
Get the value, loading it if necessary.
|
protected abstract int |
getEntryWeight(T value)
Estimation includes the key's overhead, see
EmpiricalWeigher for
an example |
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.
|
@Nonnull public org.apache.jackrabbit.oak.cache.CacheStats getStats()
@Nonnull public T get(long msb, long lsb, int offset, com.google.common.base.Function<Integer,T> loader)
msb
- the msb of the segmentlsb
- the lsb of the segmentoffset
- the offsetloader
- the loader functionpublic void clear()
protected abstract int getEntryWeight(T value)
EmpiricalWeigher
for
an exampleprotected abstract boolean isSmall(T value)
Copyright © 2012-2016 The Apache Software Foundation. All Rights Reserved.