Package org.mariadb.jdbc.client.impl

## Class PrepareCache

- java.lang.Object
- - java.util.AbstractMap<K,​V>
  - - java.util.HashMap<K,​V>
    - - java.util.LinkedHashMap<String,​CachedPrepareResultPacket>
      - - org.mariadb.jdbc.client.impl.PrepareCache

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Map<String,​CachedPrepareResultPacket>`, `org.mariadb.jdbc.client.PrepareCache`

    public final class PrepareCache
    extends LinkedHashMap<String,​CachedPrepareResultPacket>
    implements org.mariadb.jdbc.client.PrepareCache

LRU prepare cache

See Also:
  Serialized Form

### Nested Class Summary

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

`AbstractMap.SimpleEntry<K extends Object,​V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,​V extends Object>`

### Constructor Summary

Constructors
`PrepareCache​(int size, StandardClient con)` LRU prepare cache constructor

### Method Summary

All Methods Instance Methods Concrete Methods
`CachedPrepareResultPacket` `get​(Object key)`
`Prepare` `get​(String key, ServerPreparedStatement preparedStatement)` Get cache value for key
`Prepare` `put​(String key, Prepare result, ServerPreparedStatement preparedStatement)` Add a prepare cache value
`CachedPrepareResultPacket` `put​(String key, PrepareResultPacket result)` NOT USED
`boolean` `removeEldestEntry​(Map.Entry<String,​CachedPrepareResultPacket> eldest)`
`void` `reset()` Reset cache

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

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

### Constructor Detail

#### PrepareCache

    public PrepareCache​(int size,
                        StandardClient con)

LRU prepare cache constructor

Parameters:
  `size` - cache size
  `con` - client

### Method Detail

#### removeEldestEntry

    public boolean removeEldestEntry​(Map.Entry<String,​CachedPrepareResultPacket> eldest)

Overrides:
  `removeEldestEntry` in class `LinkedHashMap<String,​CachedPrepareResultPacket>`

#### get

    public Prepare get​(String key,
                       ServerPreparedStatement preparedStatement)

Description copied from interface: `org.mariadb.jdbc.client.PrepareCache`
Get cache value for key

Specified by:
  `get` in interface `org.mariadb.jdbc.client.PrepareCache`
Parameters:
  `key` - key
  `preparedStatement` - prepared statement
Returns:
  Prepare value

#### put

    public Prepare put​(String key,
                       Prepare result,
                       ServerPreparedStatement preparedStatement)

Description copied from interface: `org.mariadb.jdbc.client.PrepareCache`
Add a prepare cache value

Specified by:
  `put` in interface `org.mariadb.jdbc.client.PrepareCache`
Parameters:
  `key` - key
  `result` - value
  `preparedStatement` - prepared statement
Returns:
  Prepare if was already cached

#### get

    public CachedPrepareResultPacket get​(Object key)

Specified by:
  `get` in interface `Map<String,​CachedPrepareResultPacket>`
Overrides:
  `get` in class `LinkedHashMap<String,​CachedPrepareResultPacket>`

#### put

    public CachedPrepareResultPacket put​(String key,
                                         PrepareResultPacket result)

NOT USED

Parameters:
  `key` - key
  `result` - results
Returns:
  will throw an exception

#### reset

    public void reset()

Description copied from interface: `org.mariadb.jdbc.client.PrepareCache`
Reset cache

Specified by:
  `reset` in interface `org.mariadb.jdbc.client.PrepareCache`