Package com.mckoi.database

## Class StatementCache

- java.lang.Object
- - com.mckoi.database.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.

Author:
  Tobias Downer

### Constructor Summary

Constructors
`StatementCache​(DatabaseSystem system, int hash_size, int max_size, int clean_percentage)` Constructs the cache.

### Method Summary

All Methods Instance Methods Concrete Methods
`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`

### 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.