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 CachedPrepareResultPacketget(Object key)Prepareget(String key, ServerPreparedStatement preparedStatement)Get cache value for keyPrepareput(String key, Prepare result, ServerPreparedStatement preparedStatement)Add a prepare cache valueCachedPrepareResultPacketput(String key, PrepareResultPacket result)NOT USEDbooleanremoveEldestEntry(Map.Entry<String,CachedPrepareResultPacket> eldest)voidreset()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:
removeEldestEntryin classLinkedHashMap<String,CachedPrepareResultPacket>
-
get
public Prepare get(String key, ServerPreparedStatement preparedStatement)
Description copied from interface:org.mariadb.jdbc.client.PrepareCacheGet cache value for key- Specified by:
getin 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.PrepareCacheAdd a prepare cache value- Specified by:
putin 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:
getin interfaceMap<String,CachedPrepareResultPacket>- Overrides:
getin 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.PrepareCacheReset cache- Specified by:
resetin interfaceorg.mariadb.jdbc.client.PrepareCache
-
-