public class PstmtCache extends LinkedHashMap<String,ExtendedPreparedStatement>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
protected String |
cacheName
The name of the cache, for tracing purposes.
|
| Constructor and Description |
|---|
PstmtCache(String cacheName,
int maxCacheSize) |
| Modifier and Type | Method and Description |
|---|---|
ExtendedPreparedStatement |
get(Object key)
additionally maintains hit and miss statistics.
|
String |
getDescription()
Return a summary description of this cache.
|
int |
getHitCounter()
The total number of hits against this cache.
|
int |
getHitRatio()
Gets the hit ratio.
|
int |
getMaxSize()
returns the current maximum size of the cache.
|
int |
getMissCounter()
The total number of misses against this cache.
|
int |
getPutCounter()
The total number of puts against this cache.
|
ExtendedPreparedStatement |
put(String key,
ExtendedPreparedStatement value)
additionally maintains put counter statistics.
|
ExtendedPreparedStatement |
remove(Object key)
additionally maintains hit and miss statistics.
|
protected boolean |
removeEldestEntry(Map.Entry<String,ExtendedPreparedStatement> eldest)
will check to see if we need to remove entries and
if so call the cacheCleanup.cleanupEldestLRUCacheEntry() if
one has been set.
|
boolean |
returnStatement(ExtendedPreparedStatement pstmt)
Try to add the returning statement to the cache.
|
clear, containsValueclone, containsKey, entrySet, isEmpty, keySet, putAll, size, valuesequals, hashCode, toStringprotected final String cacheName
public PstmtCache(String cacheName, int maxCacheSize)
public String getDescription()
public int getMaxSize()
public int getHitRatio()
public int getHitCounter()
public int getMissCounter()
public int getPutCounter()
public boolean returnStatement(ExtendedPreparedStatement pstmt)
public ExtendedPreparedStatement get(Object key)
get in interface Map<String,ExtendedPreparedStatement>get in class LinkedHashMap<String,ExtendedPreparedStatement>public ExtendedPreparedStatement remove(Object key)
remove in interface Map<String,ExtendedPreparedStatement>remove in class HashMap<String,ExtendedPreparedStatement>public ExtendedPreparedStatement put(String key, ExtendedPreparedStatement value)
put in interface Map<String,ExtendedPreparedStatement>put in class HashMap<String,ExtendedPreparedStatement>protected boolean removeEldestEntry(Map.Entry<String,ExtendedPreparedStatement> eldest)
removeEldestEntry in class LinkedHashMap<String,ExtendedPreparedStatement>Copyright © 2014. All Rights Reserved.