lru_cache is most performant with maxsize=None, otherwise it will include
locking for thread-safety.