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 StandardClientclientprivate final intcache 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 USEDbooleanvoidreset()Reset cacheMethods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, getOrDefault, keySet, replaceAll, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
removeEldestEntryin classLinkedHashMap<String,CachedPrepareResultPacket>
-
get
Description copied from interface:PrepareCacheGet cache value for key- Specified by:
getin interfacePrepareCache- Parameters:
key- keypreparedStatement- prepared statement- Returns:
- Prepare value
-
put
Description copied from interface:PrepareCacheAdd a prepare cache value- Specified by:
putin interfacePrepareCache- Parameters:
key- keyresult- valuepreparedStatement- prepared statement- Returns:
- Prepare if was already cached
-
get
- Specified by:
getin interfaceMap<String,CachedPrepareResultPacket> - Overrides:
getin classLinkedHashMap<String,CachedPrepareResultPacket>
-
put
NOT USED- Parameters:
key- keyresult- results- Returns:
- will throw an exception
-
reset
public void reset()Description copied from interface:PrepareCacheReset cache- Specified by:
resetin interfacePrepareCache
-