Use memoize from functools
import logging
from contextlib import contextmanager
-from plex_trakt_sync.memoize import Memoize as memoize
-from plex_trakt_sync.nocache import CacheDisabledDecorator as nocache
from time import time
+from plex_trakt_sync.nocache import CacheDisabledDecorator as nocache
+
+try:
+ from functools import cache as memoize
+except ImportError:
+ # For py<3.9
+ # https://docs.python.org/3.9/library/functools.html
+ from functools import lru_cache
+
+
+ def memoize(user_function, /):
+ 'Simple lightweight unbounded cache. Sometimes called "memoize".'
+ return lru_cache(maxsize=None)(user_function)
@contextmanager
