title: Using functools lru_cache, how can I determine if the function returned me cached data?
body: <p>I have a simple implementation using the wrapper lru_cache around a function that fetches data from a remote database. I want to be able to tell if the result might be "stale" (i.e., it was fetched from the cache vs from the database). How can I figure that out?</p>
  
  <p>Code is simple, just:</p>
  
  <pre><code>@lru_cache(maxsize=2048)
  def fetch_cached_data(query, *args, **kwargs):
      return fetch_data(query, *args, **kwargs)
  </code></pre>