public class ProcedureCache extends java.lang.Object implements StatementCache
| Modifier and Type | Class and Description | 
|---|---|
| private static class  | ProcedureCache.CacheEntryEncapsulates the cached Object and implements the linked list used to
 implement the LRU logic. | 
| Modifier and Type | Field and Description | 
|---|---|
| private java.util.HashMap | cacheThe actual cache instance. | 
| (package private) int | cacheSizeMaximum cache size or 0 to disable. | 
| (package private) java.util.ArrayList | freeList of redundant cache entries. | 
| (package private) ProcedureCache.CacheEntry | headHead node of the linked list. | 
| private static int | MAX_INITIAL_SIZEThe maximum initial HashMap size. | 
| (package private) ProcedureCache.CacheEntry | tailTail node of the linked list. | 
| Constructor and Description | 
|---|
| ProcedureCache(int cacheSize)Constructs a new statement cache. | 
| Modifier and Type | Method and Description | 
|---|---|
| java.lang.Object | get(java.lang.String key)Retrieves a ProcEntry object from the cache. | 
| java.util.Collection | getObsoleteHandles(java.util.Collection handles)Obtains a list of statement handles or procedures that can now be
 dropped. | 
| void | put(java.lang.String key,
   java.lang.Object handle)Inserts a new entry, identified by a key, into the cache. | 
| void | remove(java.lang.String key)Removes a redundant entry from the cache. | 
| private void | scavengeCache()Removes unused entries trying to bring down the cache to the requested
 size. | 
private static final int MAX_INITIAL_SIZE
private java.util.HashMap cache
int cacheSize
ProcedureCache.CacheEntry head
ProcedureCache.CacheEntry tail
java.util.ArrayList free
public ProcedureCache(int cacheSize)
cacheSize - maximum cache size or 0 to disable cachingpublic java.lang.Object get(java.lang.String key)
get in interface StatementCachekey - the key value identifying the required entryObject or null if the entry
         does not existpublic void put(java.lang.String key,
       java.lang.Object handle)
put in interface StatementCachekey - value used to identify the entryhandle - proc entry to be inserted into the cachepublic void remove(java.lang.String key)
remove in interface StatementCachekey - value that identifies the cache entrypublic java.util.Collection getObsoleteHandles(java.util.Collection handles)
getObsoleteHandles in interface StatementCachehandles - a collection of single use statements that will be
                returned for dropping if the cache is disabledprivate void scavengeCache()
Generated on June 8 2013