Class QueryPlanCache

java.lang.Object
org.litebridge.orm.engine.QueryPlanCache

public final class QueryPlanCache extends Object
Caches SQL execution plans based on the structural fingerprint of a Select operation.
  • Constructor Details

    • QueryPlanCache

      public QueryPlanCache()
  • Method Details

    • get

      public @Nullable QueryPlanCache.CachedOperation get(QueryNode node)
      Retrieves a cached execution plan for the given select operation.
      Parameters:
      node - the AST terminating node
      Returns:
      the cached prepared SQL, or null if not found
    • get

      public @Nullable QueryPlanCache.CachedOperation get(int nodeHash)
      Retrieves a cached execution plan for the given select operation.
      Parameters:
      nodeHash - the AST terminating node hash
      Returns:
      the cached prepared SQL, or null if not found
    • put

      public void put(QueryNode node, QueryPlanCache.CachedOperation cachedOperation)
      Stores an execution plan in the cache.
      Parameters:
      node - the AST terminating node
    • put

      public void put(int nodeHash, QueryPlanCache.CachedOperation cachedOperation)
      Stores an execution plan in the cache.
      Parameters:
      nodeHash - the AST terminating node hash
    • size

      public int size()
      Returns the current cache size.
      Returns:
      the current cache size.
    • clear

      public void clear()
      Clears the cache.