org.mariadb.jdbc.internal.util

## Class PrepareStatementCache

- java.lang.Object
- - java.util.AbstractMap<K,V>
  - - java.util.HashMap<K,V>
    - - java.util.LinkedHashMap<String,PrepareResult>
      - - org.mariadb.jdbc.internal.util.PrepareStatementCache

All Implemented Interfaces:
  Serializable, Cloneable, Map<String,PrepareResult>

    public final class PrepareStatementCache
    extends LinkedHashMap<String,PrepareResult>

See Also:
  Serialized Form

### Nested Class Summary

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

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

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static PrepareStatementCache` `newInstance(int size, Protocol protocol)`
`PrepareResult` `put(String key, PrepareResult result, boolean force)` Associates the specified value with the specified key in this map.
`boolean` `removeEldestEntry(Map.Entry eldest)` Remove eldestEntry.
`String` `toString()`

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

`clear, 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

`equals, hashCode`

### 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, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size`

### Method Detail

#### newInstance

    public static PrepareStatementCache newInstance(int size,
                                                    Protocol protocol)

#### removeEldestEntry

    public boolean removeEldestEntry(Map.Entry eldest)

Remove eldestEntry.

Overrides:
  `removeEldestEntry` in class `LinkedHashMap<String,PrepareResult>`
Parameters:
  `eldest` - eldest entry
Returns:
  true if eldest entry must be removed

#### put

    public PrepareResult put(String key,
                             PrepareResult result,
                             boolean force)

Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the existing cached prepared result shared counter will be incremented.

Parameters:
  `key` - key
  `result` - new prepare result.
  `force` - flag to indicate if cache must be forced (after a failover)
Returns:
  the previous value associated with key if not been deallocate, or null if there was no mapping for key.

#### toString

    public String toString()

Overrides:
  `toString` in class `AbstractMap<String,PrepareResult>`