We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Sometimes I need to invalidate the cache or need an empty cache in my tests. I didn't see any simple solution to clear it.
Currently im doing it like this:
from cache import AsyncTTL @AsyncTTL(...) async def my_function(...): ...
in order to clear the cache I have to this:
my_function.__closure__[1].cell_contents.ttl.clear()
it would be nice to have this function easily accessible like (same as functools.lru):
functools.lru
my_function.clear_cache()
and maybe even have access to the non-wrapped function with:
my_function.__wrapped__
which would be useful to disable cache during tests my mocking the cached function in conftest.py:
@pytest.fixture(auto_use=True) def no_cache(monkeypatch): monkeypatch.setattribute(my_module, 'my_function', my_module.my_function.__wrapped__)
Would be a nice improvement if something like this would be implemented :)
The text was updated successfully, but these errors were encountered:
Hi! I just ran into the same issue. The PR #23 has a solution.
Sorry, something went wrong.
Thanks @MarijnHoum for adding this feature, will be a great help. Will close this issue when new version is released.
No branches or pull requests
Sometimes I need to invalidate the cache or need an empty cache in my tests. I didn't see any simple solution to clear it.
Currently im doing it like this:
in order to clear the cache I have to this:
it would be nice to have this function easily accessible like (same as
functools.lru
):and maybe even have access to the non-wrapped function with:
which would be useful to disable cache during tests my mocking the cached function in conftest.py:
Would be a nice improvement if something like this would be implemented :)
The text was updated successfully, but these errors were encountered: