Class ServerPrepareStatementCache

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,​ServerPrepareResult>

    public final class ServerPrepareStatementCache
    extends java.util.LinkedHashMap<java.lang.String,​ServerPrepareResult>
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ServerPrepareStatementCache newInstance​(int size, Protocol protocol)  
      ServerPrepareResult put​(java.lang.String key, ServerPrepareResult result)
      Associates the specified value with the specified key in this map.
      boolean removeEldestEntry​(java.util.Map.Entry eldest)
      Remove eldestEntry.
      java.lang.String toString()  
      • Methods inherited from class java.util.LinkedHashMap

        clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
      • Methods inherited from class java.util.HashMap

        clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, size
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode
      • 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, putAll, putIfAbsent, remove, remove, replace, replace, size
    • Field Detail

      • maxSize

        private final int maxSize
      • protocol

        private final Protocol protocol
    • Constructor Detail

      • ServerPrepareStatementCache

        private ServerPrepareStatementCache​(int size,
                                            Protocol protocol)
    • Method Detail

      • removeEldestEntry

        public boolean removeEldestEntry​(java.util.Map.Entry eldest)
        Remove eldestEntry.
        Overrides:
        removeEldestEntry in class java.util.LinkedHashMap<java.lang.String,​ServerPrepareResult>
        Parameters:
        eldest - eldest entry
        Returns:
        true if eldest entry must be removed
      • put

        public ServerPrepareResult put​(java.lang.String key,
                                       ServerPrepareResult result)
        Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the existing cached prepared result shared counter will be incremented.
        Specified by:
        put in interface java.util.Map<java.lang.String,​ServerPrepareResult>
        Overrides:
        put in class java.util.HashMap<java.lang.String,​ServerPrepareResult>
        Parameters:
        key - key
        result - new prepare result.
        Returns:
        the previous value associated with key if not been deallocate, or null if there was no mapping for key.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.AbstractMap<java.lang.String,​ServerPrepareResult>