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

Methods
`void` `clear()`
`java.lang.Object` `clone()`
`static double` `computeUsedHeapPercentage()`
`boolean` `containsKey(java.lang.Object key)`
`boolean` `containsValue(java.lang.Object value)`
`java.util.Set<java.util.Map.Entry<java.lang.String,IfxPreparedStatement>>` `entrySet()`
`boolean` `equals(java.lang.Object o)`
`IfxPreparedStatement` `get(java.lang.Object key)`
`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()`
`int` `hashCode()`
`boolean` `isEmpty()`
`java.util.Set<java.lang.String>` `keySet()`
`IfxPreparedStatement` `put(java.lang.String key, IfxPreparedStatement value)`
`void` `putAll(java.util.Map<? extends java.lang.String,? extends IfxPreparedStatement> m)`
`IfxPreparedStatement` `remove(java.lang.Object id)`
`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)`
`int` `size()`
`java.util.Collection<IfxPreparedStatement>` `values()`

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

`toString`

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

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

### 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

#### 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)

#### get

    public IfxPreparedStatement get(java.lang.Object key)

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

#### 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>`

#### remove

    public IfxPreparedStatement remove(java.lang.Object id)

Specified by:
  `remove` in interface `java.util.Map<java.lang.String,IfxPreparedStatement>`
Overrides:
  `remove` in class `java.util.HashMap<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>`

#### containsValue

    public boolean containsValue(java.lang.Object value)

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

#### size

    public int size()

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

#### isEmpty

    public boolean isEmpty()

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

#### containsKey

    public boolean containsKey(java.lang.Object key)

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

#### put

    public IfxPreparedStatement put(java.lang.String key,
                           IfxPreparedStatement value)

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

#### putAll

    public void putAll(java.util.Map<? extends java.lang.String,? extends IfxPreparedStatement> m)

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

#### clone

    public java.lang.Object clone()

Overrides:
  `clone` in class `java.util.HashMap<java.lang.String,IfxPreparedStatement>`

#### keySet

    public java.util.Set<java.lang.String> keySet()

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

#### values

    public java.util.Collection<IfxPreparedStatement> values()

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

#### entrySet

    public java.util.Set<java.util.Map.Entry<java.lang.String,IfxPreparedStatement>> entrySet()

Specified by:
  `entrySet` in interface `java.util.Map<java.lang.String,IfxPreparedStatement>`
Overrides:
  `entrySet` in class `java.util.HashMap<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>`