Make @lru_cache ignore some of the function arguments
问题 How can I make @functools.lru_cache decorator ignore some of the function arguments with regard to caching key? For example, I have a function that looks like this: def find_object(db_handle, query): # (omitted code) return result If I apply lru_cache decorator just like that, db_handle will be included in the cache key. As a result, if I try to call the function with the same query , but different db_handle , it will be executed again, which I'd like to avoid. I want lru_cache to consider