com.informix.jdbc

## Class PreparedStatementCache

- java.lang.Object
- - java.util.AbstractMap<K,V>
  - - java.util.HashMap<K,V>
    - - java.util.LinkedHashMap<java.lang.String,IfxPreparedStatement>
      - - com.informix.jdbc.PreparedStatementCache

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,IfxPreparedStatement>

    public class PreparedStatementCache
    extends java.util.LinkedHashMap<java.lang.String,IfxPreparedStatement>

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from class java.util.AbstractMap

`java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>`

### Field Summary

Fields
`protected int` `initialMaximumEntries`
`protected long` `maximumDelay`
`protected long` `minimumDelay`
`protected int` `zeroPointPercentage`

### Constructor Summary

Constructors
Constructor and Description
`PreparedStatementCache(IfxSqliConnect connection, int maximumEntries)` Creates a new LRU map based on a LinkedHashMap that supports an upper-limit on the number of entries.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `clear()`
`static double` `computeUsedHeapPercentage()`
`boolean` `equals(java.lang.Object o)`
`static java.util.List<org.bson.BSONObject>` `getCacheInfo()`
`int` `getMaximumEntries()` Returns the maximum number of entries allowed in this LRU map.
`static DelayedWeakReference<PreparedStatementCache>[]` `getPreparedStatementCaches()`
`static com.informix.jdbc.PreparedStatementCache.PreparedStatementCleanupThread` `getPreparedStatementCleanupThread()`
`int` `hashCode()`
`protected boolean` `removeEldestEntry(java.util.Map.Entry<java.lang.String,IfxPreparedStatement> eldest)` Returns `true` if the maximum number of entries has been exceeded in the map and therefore the eldest entry needs to be removed.
`void` `setMaximumEntries(int maximumEntries)`
`static void` `startCache()`
`static void` `stopCache()`

### Methods inherited from class java.util.LinkedHashMap

`containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values`

### Methods inherited from class java.util.HashMap

`clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size`

### Methods inherited from class java.util.AbstractMap

`toString`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.Map

`compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size`

### Field Detail

#### initialMaximumEntries

    protected final int initialMaximumEntries

#### zeroPointPercentage

    protected final int zeroPointPercentage

#### minimumDelay

    protected final long minimumDelay

#### maximumDelay

    protected final long maximumDelay

### Constructor Detail

#### PreparedStatementCache

    public PreparedStatementCache(IfxSqliConnect connection,
                                  int maximumEntries)

Creates a new LRU map based on a LinkedHashMap that supports an upper-limit on the number of entries. The eldest (oldest) entry in the map will be removed when the maximum number of entries allowed is exceeded.

Parameters:
  `maximumKEntries` - the maximum number of entries to allow in the LRU map

### Method Detail

#### getPreparedStatementCleanupThread

    public static com.informix.jdbc.PreparedStatementCache.PreparedStatementCleanupThread getPreparedStatementCleanupThread()

#### startCache

    public static void startCache()

#### stopCache

    public static void stopCache()

#### getCacheInfo

    public static java.util.List<org.bson.BSONObject> getCacheInfo()

#### getPreparedStatementCaches

    public static DelayedWeakReference<PreparedStatementCache>[] getPreparedStatementCaches()

#### computeUsedHeapPercentage

    public static double computeUsedHeapPercentage()

#### getMaximumEntries

    public int getMaximumEntries()

Returns the maximum number of entries allowed in this LRU map.

Returns:
  the maximum number of entries allowed in this LRU map.

#### setMaximumEntries

    public void setMaximumEntries(int maximumEntries)

#### removeEldestEntry

    protected boolean removeEldestEntry(java.util.Map.Entry<java.lang.String,IfxPreparedStatement> eldest)

Returns `true` if the maximum number of entries has been exceeded in the map and therefore the eldest entry needs to be removed.

Overrides:
  `removeEldestEntry` in class `java.util.LinkedHashMap<java.lang.String,IfxPreparedStatement>`

#### clear

    public void clear()

Specified by:
  `clear` in interface `java.util.Map<java.lang.String,IfxPreparedStatement>`
Overrides:
  `clear` in class `java.util.LinkedHashMap<java.lang.String,IfxPreparedStatement>`

#### equals

    public boolean equals(java.lang.Object o)

Specified by:
  `equals` in interface `java.util.Map<java.lang.String,IfxPreparedStatement>`
Overrides:
  `equals` in class `java.util.AbstractMap<java.lang.String,IfxPreparedStatement>`

#### hashCode

    public int hashCode()

Specified by:
  `hashCode` in interface `java.util.Map<java.lang.String,IfxPreparedStatement>`
Overrides:
  `hashCode` in class `java.util.AbstractMap<java.lang.String,IfxPreparedStatement>`