Skip to content
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

feat: add invalidate_cache for @cached decorator #927

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

biraj21
Copy link

@biraj21 biraj21 commented Nov 22, 2024

What do these changes do?

This PR adds an invalidate_cache function to the aiocache library, allowing users to explicitly invalidate the cache of a function decorated with @cache. Users can call the method directly on the cached function object with the arguments that were used to generate the cache key. Usage:

await <function_name>.invalidate_cache(*args, **kwargs)

Are there changes in behavior for the user?

Yes, this new functionality provides users with a convenient way to manually invalidate the cache for specific arguments of a cached function, enhancing flexibility and control over cache management.

Related issue number

N/A

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

@altairmn
Copy link

What's the progress on this feature? it'd be great to have cache invalidation. Otherwise, the workaround for this is very messy.

@Dreamsorcerer
Copy link
Member

I'd prefer to avoid adding more hacks like this onto the old code. This should really wait for #625 to be completed, which may require the other tasks listed before it in the milestone: https://github.com/aio-libs/aiocache/milestone/8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants