add cache.
parse path.
use stack to parse the path.