Skip to content

Added the function of clearing cache#40

Merged
SKProCH merged 1 commit intoAvaloniaUtils:masterfrom
hatulaile:master
Mar 1, 2026
Merged

Added the function of clearing cache#40
SKProCH merged 1 commit intoAvaloniaUtils:masterfrom
hatulaile:master

Conversation

@hatulaile
Copy link
Copy Markdown
Contributor

issue: #39

Copy link
Copy Markdown
Member

@SKProCH SKProCH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that we actually need the separate interface for clearing the cache. I suppose this is can be just ClearRamCache method (also because users can think about that the interface and method would clean the file cache, for example) and this is would be fine. What do you think?

@hatulaile
Copy link
Copy Markdown
Contributor Author

I'm not sure that we actually need the separate interface for clearing the cache. I suppose this is can be just ClearRamCache method (also because users can think about that the interface and method would clean the file cache, for example) and this is would be fine. What do you think?

I created an interface because users might inherit from RamCachedWebImageLoader or implement an AsyncImageLoader.

Maybe I should implement cleaning the file cache?

@SKProCH
Copy link
Copy Markdown
Member

SKProCH commented Feb 28, 2026

users might inherit from RamCachedWebImageLoader

Yeah, this is valid scenario, and the method in RamCachedWebImageLoader still handles it, isn't it?

implement an AsyncImageLoader

Also yes, but I suppose that this method is the specialty of the specific loader, instead of being something common.

Maybe I should implement cleaning the file cache?

Yeah, if we want to achieve the "some loaders can clear the cache by itself", this is probably the proper solution. But from the other side, I've actually can't see the case when the App developer wants to clear the file cache. Yeah, the RAM cache clearing is fine, since it consumes the RAM, but the files...

I don't sure, and want to listen to your thoughts.

@hatulaile
Copy link
Copy Markdown
Contributor Author

hatulaile commented Mar 1, 2026

You're right, I was overthinking it, sorry.

Yeah, this is valid scenario, and the method in RamCachedWebImageLoader still handles it, isn't it?

I agree.

Also yes, but I suppose that this method is the specialty of the specific loader, instead of being something common.

I agree. If the developers implements their own AsyncImageLoader with caching, they may not necessarily need to clean the cache.

Yeah, if we want to achieve the "some loaders can clear the cache by itself", this is probably the proper solution. But from the other side, I've actually can't see the case when the App developer wants to clear the file cache. Yeah, the RAM cache clearing is fine, since it consumes the RAM, but the files...

If developers do need to clean the file cache, they can solve it through other methods.

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.

2 participants