Class StatementCache

java.lang.Object
com.mckoi.database.StatementCache

public final class StatementCache extends 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.

Author:
Tobias Downer
  • Constructor Details

    • StatementCache

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

    • Debug

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

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

      public StatementTree get(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.