| Constructor and Description |
|---|
RecordCache() |
| Modifier and Type | Method and Description |
|---|---|
abstract long |
estimateCurrentWeight() |
static <T> com.google.common.base.Supplier<RecordCache<T>> |
factory(int size) |
static <T> com.google.common.base.Supplier<RecordCache<T>> |
factory(int size,
com.google.common.cache.Weigher<T,RecordId> weigher) |
abstract RecordId |
get(T key) |
com.google.common.cache.CacheStats |
getStats() |
static <T> RecordCache<T> |
newRecordCache(int size)
Factory method for creating
RecordCache instances. |
abstract void |
put(T key,
RecordId value)
Add a mapping from
key to value. |
abstract long |
size() |
public abstract void put(@Nonnull T key, @Nonnull RecordId value)
key to value. Any existing mapping is replaced.@CheckForNull public abstract RecordId get(@Nonnull T key)
key, or null if none.public abstract long size()
public abstract long estimateCurrentWeight()
@Nonnull public com.google.common.cache.CacheStats getStats()
@Nonnull public static <T> RecordCache<T> newRecordCache(int size)
RecordCache 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 exceed size.RecordCache instance of the given size.@Nonnull public static <T> com.google.common.base.Supplier<RecordCache<T>> factory(int size, @Nonnull com.google.common.cache.Weigher<T,RecordId> weigher)
size - size of the cacheweigher - Needed to provide an estimation of the cache weight in memoryRecordCache instances of the given size
when invoked.newRecordCache(int)@Nonnull public static <T> com.google.common.base.Supplier<RecordCache<T>> factory(int size)
size - size of the cacheRecordCache instances of the given size
when invoked.newRecordCache(int)Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.