core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExecutionPlanCache.java
public OExecutionPlan getInternal(String statement, OCommandContext ctx, ODatabaseDocumentInternal db) {
    OInternalExecutionPlan result;
    if (statement == null) {
      return null;
    }
    synchronized (map) {
      //LRU
      result = map.remove(statement);
      if (result != null) {
        map.put(statement, result);
        result = result.copy(ctx);
      }
    }

    return result;
  }
public OExecutionPlan getInternal(String statement, OCommandContext ctx, ODatabaseDocumentInternal db) {
    OInternalExecutionPlan result;
    if (statement == null) {
      return null;
    }
    synchronized (map) {
      //LRU
      result = map.remove(statement);
      if (result != null) {
        map.put(statement, result);
        result = result.copy(ctx);
      }
    }

    return result;
  }
@param statement an SQL statement
@param ctx

@return the corresponding executor, taking it from the internal cache, if it exists