I'm exploiting the cachetools @ttl_cache decorator (not @cached). I need to ignore some params in the cache key. E.g,.
@ttl_cache(maxsize=1024, ttl=600)
def my_func(foo, ignore_bar, ignore_baz):
# do stuff
Working that way, I get this:
>>> my_func("foo", "ignore_bar", "ignore_baz") # cache miss
>>> my_func("foo", "ignore_bar", "ignore_baz") # cache hit
>>> my_func("foo", "ignore_bar_bar", "ignore_baz_baz") # cache miss!
What I need:
>>> my_func("foo", "ignore_bar", "ignore_baz") # cache miss
>>> my_func("foo", "ignore_bar", "ignore_baz") # cache hit
>>> my_func("foo", "ignore_bar_bar", "ignore_baz_baz") # cache hit!!!!!
Is there a way to get that using @ttl_cache?