Refactor default cache path logic.