Class OExecutionPlanCache
java.lang.Object
com.orientechnologies.orient.core.sql.parser.OExecutionPlanCache
- All Implemented Interfaces:
OMetadataUpdateListener
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 (l.dellaquila-(at)-orientdb.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic OExecutionPlanget(String statement, OCommandContext ctx, ODatabaseDocumentInternal db) returns an already prepared SQL execution plan, taking it from the cache if it exists or creating a new one if it doesn'tgetInternal(String statement, OCommandContext ctx, ODatabaseDocumentInternal db) static longstatic OExecutionPlanCachevoidvoidonFunctionLibraryUpdate(String database) voidonIndexManagerUpdate(String database, OIndexManagerAbstract indexManager) voidonSchemaUpdate(String database, OSchemaShared schema) voidonSequenceLibraryUpdate(String database) voidonStorageConfigurationUpdate(String database, OStorageConfiguration update) static voidput(String statement, OExecutionPlan plan, ODatabaseDocumentInternal db) voidputInternal(String statement, OExecutionPlan plan, ODatabaseDocumentInternal db)
-
Field Details
-
lastInvalidation
protected long lastInvalidation -
lastGlobalTimeout
protected long lastGlobalTimeout
-
-
Constructor Details
-
OExecutionPlanCache
public OExecutionPlanCache(int size) - Parameters:
size- the size of the cache
-
-
Method Details
-
getLastInvalidation
-
contains
- Parameters:
statement- an SQL statement- Returns:
- true if the corresponding executor is present in the cache
-
get
public static OExecutionPlan get(String statement, OCommandContext ctx, ODatabaseDocumentInternal db) 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-db- the current DB instance- Returns:
- a statement executor from the cache
-
put
-
putInternal
-
getInternal
public OExecutionPlan getInternal(String statement, OCommandContext ctx, ODatabaseDocumentInternal db) - Parameters:
statement- an SQL statementctx-- Returns:
- the corresponding executor, taking it from the internal cache, if it exists
-
invalidate
public void invalidate() -
onIndexManagerUpdate
- Specified by:
onIndexManagerUpdatein interfaceOMetadataUpdateListener
-
onFunctionLibraryUpdate
- Specified by:
onFunctionLibraryUpdatein interfaceOMetadataUpdateListener
-
onSequenceLibraryUpdate
- Specified by:
onSequenceLibraryUpdatein interfaceOMetadataUpdateListener
-
onStorageConfigurationUpdate
- Specified by:
onStorageConfigurationUpdatein interfaceOMetadataUpdateListener
-
instance
-