public void preNodeVisited(Node<T> node, int depth, NodeType type) {
    // perform the caching here before the node starts
    if (type == NodeType.START) {

      /* fetch node from cache rather then the node passed in as it may not be the
       * exact same node cached. If it's not it will have a different parent so to
       * clean the cache of the original values, we will need to use the parent that the cache
       */
      NodeItem<T> cacheNode = cache.get(node);

      if (cacheNode != null) {

        clearParentsAndNonConsideredSubTrees(cacheNode.getCachedParent());
      }
    }
  }
  public Iterable<Node<T>> getSuccessors(Node<T> node, NodeType type) {
    // check cache first

    NodeItem<T> cachedSuccessorNodes = cache.get(node);

    if (cachedSuccessorNodes == null || cachedSuccessorNodes.getNodeType() != type) {
      // compute new results.
      // LOG.debug("cache miss with node: "+node.getId());
      Iterable<Node<T>> computedSuccessors = workerSuccessorService.getSuccessors(node, type);
      // add to cache

      cachedSuccessorNodes = new NodeItem<T>(type, computedSuccessors, node);
      cache.put(node, cachedSuccessorNodes);
    } else {
      LOG.debug("cache hit with node: " + node.getId());
    }

    return cachedSuccessorNodes.getSuccessors();
  }