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 Constructor Description PrepareCache(int size, StandardClient con)
LRU prepare cache constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CachedPrepareResultPacket
get(Object key)
Prepare
get(String key, ServerPreparedStatement preparedStatement)
Get cache value for keyPrepare
put(String key, Prepare result, ServerPreparedStatement preparedStatement)
Add a prepare cache valueCachedPrepareResultPacket
put(String key, PrepareResultPacket result)
NOT USEDboolean
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 sizecon
- client
-
-
Method Detail
-
removeEldestEntry
public boolean removeEldestEntry(Map.Entry<String,CachedPrepareResultPacket> eldest)
- Overrides:
removeEldestEntry
in classLinkedHashMap<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 interfaceorg.mariadb.jdbc.client.PrepareCache
- Parameters:
key
- keypreparedStatement
- 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 interfaceorg.mariadb.jdbc.client.PrepareCache
- Parameters:
key
- keyresult
- valuepreparedStatement
- prepared statement- Returns:
- Prepare if was already cached
-
get
public CachedPrepareResultPacket get(Object key)
- Specified by:
get
in interfaceMap<String,CachedPrepareResultPacket>
- Overrides:
get
in classLinkedHashMap<String,CachedPrepareResultPacket>
-
put
public CachedPrepareResultPacket put(String key, PrepareResultPacket result)
NOT USED- Parameters:
key
- keyresult
- 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 interfaceorg.mariadb.jdbc.client.PrepareCache
-
-