Implement and use an @lru_cache decorator.