title: lifetime of functools lru_cache?
body: <p>I have a flask app running and I'm using it to route various requests over a socket client with various ports. The different ports point to different windows services that I've built using <code>pyinstaller</code>.</p>
  
  <p>Each windows service is responsible for consuming a list of arguments and returning a result based on some machine learning models that are unpickled and living in memory inside the service.</p>
  
  <p>I wanted to speed up calls to each service that have identical arguments using <code>lru_cache</code> from <code>functools</code>, and I am considering putting this decorator on each of the flask routes, to prevent a call to the service.</p>
  
  <p>Does anyone know how long the cache lasts? Does it only exist for the lifetime of a single call stack (using the cache for any calls that are part of this stack like rescursive function)? Or does the cache live on as long as the machine runs?</p>
  
  <p>I know that I need to set the maxsize to utilize the LRU part of the cache, and I know the args that come into the decorated function must be hashable.</p>