org.postgresql.util
Class LruCache<Key,Value extends CanEstimateSize>
java.lang.Object
org.postgresql.util.LruCache<Key,Value>
public class LruCache<Key,Value extends CanEstimateSize>
- extends Object
Caches values in simple least-recently-accessed order.
Method Summary |
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NOOP_CREATE_ACTION
public static final LruCache.CreateAction NOOP_CREATE_ACTION
NOOP_EVICT_ACTION
public static final LruCache.EvictAction NOOP_EVICT_ACTION
LruCache
public LruCache(int maxSizeEntries,
long maxSizeBytes,
boolean accessOrder)
LruCache
public LruCache(int maxSizeEntries,
long maxSizeBytes,
boolean accessOrder,
LruCache.CreateAction<Key,Value> createAction,
LruCache.EvictAction<Value> onEvict)
get
public Value get(Key key)
- Returns an entry from the cache.
- Parameters:
key
- cache key
- Returns:
- entry from cache or null if cache does not contain given key.
borrow
public Value borrow(Key key)
throws SQLException
- Borrows an entry from the cache.
- Parameters:
key
- cache key
- Returns:
- entry from cache or newly created entry if cache does not contain given key.
- Throws:
SQLException
- if entry creation fails
put
public void put(Key key,
Value value)
- Returns given value to the cache
- Parameters:
key
- keyvalue
- value
Copyright © 2017 PostgreSQL Global Development Group. All rights reserved.