public class LruCache<Key,Value extends CanEstimateSize> extends Object implements Gettable<Key,Value>
| Modifier and Type | Class and Description |
|---|---|
static interface |
LruCache.CreateAction<Key,Value>
When the entry is not present in cache, this create action is used to create one.
|
static interface |
LruCache.EvictAction<Value>
Action that is invoked when the entry is removed from the cache.
|
| Constructor and Description |
|---|
LruCache(int maxSizeEntries,
long maxSizeBytes,
boolean accessOrder) |
LruCache(int maxSizeEntries,
long maxSizeBytes,
boolean accessOrder,
@Nullable LruCache.CreateAction<Key,Value> createAction,
@Nullable LruCache.EvictAction<Value> onEvict) |
| Modifier and Type | Method and Description |
|---|---|
Value |
borrow(Key key)
Borrows an entry from the cache.
|
Value |
get(Key key)
Returns an entry from the cache.
|
void |
put(Key key,
Value value)
Returns given value to the cache.
|
void |
putAll(Map<Key,Value> m)
Puts all the values from the given map into the cache.
|
public LruCache(int maxSizeEntries,
long maxSizeBytes,
boolean accessOrder)
public LruCache(int maxSizeEntries,
long maxSizeBytes,
boolean accessOrder,
@Nullable LruCache.CreateAction<Key,Value> createAction,
@Nullable LruCache.EvictAction<Value> onEvict)
public Value get(Key key)
get in interface Gettable<Key,Value extends CanEstimateSize>key - cache keypublic Value borrow(Key key) throws SQLException
key - cache keySQLException - if entry creation failspublic void put(Key key, Value value)
key - keyvalue - valueCopyright © 1997-2020 PostgreSQL Global Development Group. All Rights Reserved.