Package org.mariadb.jdbc.client.impl
Class PrepareCache
java.lang.Object
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,
,CachedPrepareResultPacket> PrepareCache
public final class PrepareCache
extends LinkedHashMap<String,CachedPrepareResultPacket>
implements PrepareCache
LRU prepare cache
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StandardClient
clientprivate final int
cache maximum sizeprivate static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget
(String key, BasePreparedStatement preparedStatement) Get cache value for keyput
(String key, Prepare result, BasePreparedStatement preparedStatement) Add a prepare cache valueput
(String key, PrepareResultPacket result) NOT USEDboolean
void
reset()
Reset cacheMethods 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
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
maxSize
private final int maxSizecache maximum size -
con
client
-
-
Constructor Details
-
PrepareCache
LRU prepare cache constructor- Parameters:
size
- cache sizecon
- client
-
-
Method Details
-
removeEldestEntry
- Overrides:
removeEldestEntry
in classLinkedHashMap<String,
CachedPrepareResultPacket>
-
get
Description copied from interface:PrepareCache
Get cache value for key- Specified by:
get
in interfacePrepareCache
- Parameters:
key
- keypreparedStatement
- prepared statement- Returns:
- Prepare value
-
put
Description copied from interface:PrepareCache
Add a prepare cache value- Specified by:
put
in interfacePrepareCache
- Parameters:
key
- keyresult
- valuepreparedStatement
- prepared statement- Returns:
- Prepare if was already cached
-
get
- Specified by:
get
in interfaceMap<String,
CachedPrepareResultPacket> - Overrides:
get
in classLinkedHashMap<String,
CachedPrepareResultPacket>
-
put
NOT USED- Parameters:
key
- keyresult
- results- Returns:
- will throw an exception
-
reset
public void reset()Description copied from interface:PrepareCache
Reset cache- Specified by:
reset
in interfacePrepareCache
-