Class 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 Detail

      • lastInvalidation

        protected long lastInvalidation
    • 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 statement
        ctx -
        Returns:
        a statement executor from the cache
      • invalidate

        public void invalidate()