Class StatementCache


  • public final class StatementCache
    extends java.lang.Object
    A cache that maintains a serialized set of StatementTree objects that can be deserialized on demand. The purpose of this cache is to improve the performance of queries that are run repeatedly (for example, multiple INSERT statements).

    SYNCHRONIZATION: This object is safe to use over multiple threads.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Cache cache
      The internal cache representation.
      private DatabaseSystem system
      The DatabaseSystem of this cache.
    • Constructor Summary

      Constructors 
      Constructor Description
      StatementCache​(DatabaseSystem system, int hash_size, int max_size, int clean_percentage)
      Constructs the cache.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      DebugLogger Debug()
      Returns a DebugLogger object we can use to log debug messages.
      StatementTree get​(java.lang.String query_string)
      Gets a StatementTree for the query string if it is stored in the cache.
      void put​(java.lang.String query_string, StatementTree statement_tree)
      Puts a new query string/StatementTree into the cache.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • system

        private DatabaseSystem system
        The DatabaseSystem of this cache.
      • cache

        private Cache cache
        The internal cache representation.
    • Constructor Detail

      • StatementCache

        public StatementCache​(DatabaseSystem system,
                              int hash_size,
                              int max_size,
                              int clean_percentage)
        Constructs the cache.
    • Method Detail

      • Debug

        public final DebugLogger Debug()
        Returns a DebugLogger object we can use to log debug messages.
      • put

        public void put​(java.lang.String query_string,
                        StatementTree statement_tree)
        Puts a new query string/StatementTree into the cache.
      • get

        public StatementTree get​(java.lang.String query_string)
        Gets a StatementTree for the query string if it is stored in the cache. If it isn't stored in the cache returns null.