Add memoization for Router.match()