Package com.arcadedb.query.sql.parser
Class ExecutionPlanCache
- java.lang.Object
-
- com.arcadedb.query.sql.parser.ExecutionPlanCache
-
public class ExecutionPlanCache extends Object
This class is an LRU cache for already prepared SQL execution plans. It stores itself in the storage as a resource. It also acts an an entry point for the SQL executor.- Author:
- Luigi Dell'Aquila (luigi.dellaquila-(at)-gmail.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected long
lastInvalidation
-
Constructor Summary
Constructors Constructor Description ExecutionPlanCache(DatabaseInternal db, int size)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(String statement)
ExecutionPlan
get(String statement, CommandContext ctx)
returns an already prepared SQL execution plan, taking it from the cache if it exists or creating a new one if it doesn'tlong
getLastInvalidation()
static ExecutionPlanCache
instance(DatabaseInternal db)
void
invalidate()
void
put(String statement, ExecutionPlan plan)
-
-
-
Constructor Detail
-
ExecutionPlanCache
public ExecutionPlanCache(DatabaseInternal db, int size)
- Parameters:
size
- the size of the cache
-
-
Method Detail
-
getLastInvalidation
public long getLastInvalidation()
-
contains
public boolean contains(String statement)
- Parameters:
statement
- an SQL statement- Returns:
- true if the corresponding executor is present in the cache
-
get
public ExecutionPlan get(String statement, CommandContext ctx)
returns an already prepared SQL execution plan, taking it from the cache if it exists or creating a new one if it doesn't- Parameters:
statement
- the SQL statementctx
-- Returns:
- a statement executor from the cache
-
put
public void put(String statement, ExecutionPlan plan)
-
invalidate
public void invalidate()
-
instance
public static ExecutionPlanCache instance(DatabaseInternal db)
-
-