Package org.postgresql.util
Class LruCache<Key,Value extends CanEstimateSize> 
java.lang.Object
org.postgresql.util.LruCache<Key,Value> 
- All Implemented Interfaces:
- Gettable<Key,- Value> 
public class LruCache<Key,Value extends CanEstimateSize> 
extends Object
implements Gettable<Key,Value> 
Caches values in simple least-recently-accessed order.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceWhen the entry is not present in cache, this create action is used to create one.static interfaceAction that is invoked when the entry is removed from the cache.
- 
Constructor SummaryConstructorsConstructorDescriptionLruCache(int maxSizeEntries, long maxSizeBytes, boolean accessOrder) LruCache(int maxSizeEntries, long maxSizeBytes, boolean accessOrder, @Nullable LruCache.CreateAction<Key, Value> createAction, @Nullable LruCache.EvictAction<Value> onEvict) 
- 
Method SummaryModifier and TypeMethodDescriptionBorrows an entry from the cache.@Nullable ValueReturns an entry from the cache.voidReturns given value to the cache.voidPuts all the values from the given map into the cache.
- 
Constructor Details- 
LruCachepublic LruCache(int maxSizeEntries, long maxSizeBytes, boolean accessOrder) 
- 
LruCachepublic LruCache(int maxSizeEntries, long maxSizeBytes, boolean accessOrder, @Nullable LruCache.CreateAction<Key, Value> createAction, @Nullable LruCache.EvictAction<Value> onEvict) 
 
- 
- 
Method Details- 
getReturns an entry from the cache.- Specified by:
- getin interface- Gettable<Key,- Value extends CanEstimateSize> 
- Parameters:
- key- cache key
- Returns:
- entry from cache or null if cache does not contain given key.
 
- 
borrowBorrows 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
 
- 
putReturns given value to the cache.- Parameters:
- key- key
- value- value
 
- 
putAllPuts all the values from the given map into the cache.- Parameters:
- m- The map containing entries to put into the cache
 
 
-