-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cache_clear() and cache_info() would be handy in regular decorators #131
Comments
|
Got it. I missed that. As for cache info I use info about caches in other contexts to make sure my intuitions about caching the output of a function was correct (or not). In my current example, I want to use a cache to reduce database queries. If the hit ratio isn't high enough, I probably haven't achieved my goal. |
I'll be thinking about this, but don't expect anything soon... |
In regards to the performance impact of |
I'd be happy to see this too. I chose the package as the coding style seems disciplined (that's a rare compliment from me :) ), and have no intentions to turn away from it (and unlikely I would) - I just think at least for testing purposes, the ability to reset things (including caching) can be a useful convenience... I might be right in the middle of a use case :) |
I'd also love to see some cache info tracked, so that the caller can easily see if the last call was a cache hit or a cache miss.
|
I've come to this necessity because I was using the decorators (with cache_info, ...) but need to add a |
@oesteban-vx and everyone else: Thanks for nagging me ;-)
|
Hi @tkem , I tried it and it worked great, but I did have to change:
Into
Might be nice to provide the new feature directly on the |
@wimglenn: Huh? At least for me, this
prints
with |
🤦 It was a problem between keyboard and chair. I went and added
nevermind! |
Just trying cachetools for the first time. I noticed that cache_clear and cache_info attributes are available only on those caches provided for backwards compatibility with functools.lru_cache(). Is there some reason they (or something like them) aren't available on functions memoized with @cached(...)?
The text was updated successfully, but these errors were encountered: