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?
Code is simple, just:
@lru_cache(maxsize=2048) def fetch_cached_data(query, *args, **kwargs): return fetch_data(query, *args, **kwargs)