Class PrepareCache
java.lang.Object
java.util.AbstractMap<String, CachedPrepareResultPacket>
java.util.HashMap<String, CachedPrepareResultPacket>
java.util.LinkedHashMap<String, CachedPrepareResultPacket>
org.mariadb.jdbc.client.impl.PrepareCache
- All Implemented Interfaces:
Serializable, Cloneable, Map<String, CachedPrepareResultPacket>, SequencedMap<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 AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
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 LinkedHashMap
clear, containsValue, entrySet, forEach, getOrDefault, keySet, newLinkedHashMap, putFirst, putLast, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, valuesMethods inherited from class HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class AbstractMap
equals, hashCode, toStringMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from interface SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry
-
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
-