The built in caching function has a limited storage space and unused cached elements are evicted with LRU policy. As both uses a dictionary to store the data cache access time would be same O(1) constant
Great one! I'll be using this decorator in future needs. Thanks for sharing!
Sébastien Portebois
Software architect at Ubisoft
Did you try timing it against the built-in cache functions Python provides?
eg docs.python.org/3/library/functools.html
It’s indeed a good way to introduce how to create custom decorators, but for this caching purpose, I’d believe the built-in implementation will be faster.