Improve cache mechanism to handle multiple path parameters correctly