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

Calling MultiCache.clear() doesn't run the finalizers in the subcaches #352

Open
vdvman1 opened this issue Feb 11, 2023 · 3 comments
Open

Comments

@vdvman1
Copy link

vdvman1 commented Feb 11, 2023

The MultiCache.clear() method just deletes the folder and its content, and never calls the clear method of the individual caches within it, leading to the finalizers never being run

@vberlier
Copy link
Member

Last time I checked it does run the finalizers though. The method also calls super().clear(), which invokes the implementation provided by python's MutableMapping abstract base class, which calls __delitem__ for each cache entry. The MultiCache calls the Cache.delete() method when caches are removed with __delitem__ so finalizers should run fine.

@vdvman1
Copy link
Author

vdvman1 commented Feb 16, 2023

What about lazily loaded caches that haven't yet been loaded?

@vberlier
Copy link
Member

Ooh yeah you're right, I guess this could be fixed by calling self.preload() before doing anything in MultiCache.clear().

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

No branches or pull requests

2 participants