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

Add ability to clear image cache on startup, and manually #1062

Merged
merged 2 commits into from
Jan 17, 2024

Conversation

hjiangsu
Copy link
Member

Pull Request Description

This PR introduces a way to automatically clear image cache on startup. One issue that I've noticed is that the app size grows over time since image cache gets stored on the device. Because of this, the size of Thunder can grow quite large over a short period of time. This PR introduces two things:

  • A check at the start of the app to clear any old image cache (by default, this is set to image cache data older than 7 days but we may be able to make this configurable in the future)
  • An option in Settings -> Debug to see the size of the image cache, and manually clear it. This will clear all the cache as opposed to the cleanup at the start of the app.

I'm not too sure if the automatic check will happen properly as I'll have to run it over the next little bit in order to monitor app size (without uninstalling/reinstalling the app).

@micahmo Could you also do a check to see if it works on Android? As part of this, let me know what the system reports back, and what Thunder reports back for the cache size. On iOS, the image cache size and the system size differs, but that might be due to other temporary files.

Issue Being Fixed

Issue Number: N/A

Screenshots / Recordings

simulator_screenshot_DDE24F7E-9CB5-445E-882E-D90BFAA4D0BD

Checklist

  • Did you update CHANGELOG.md?
  • Did you use localized strings where applicable?
  • Did you add semanticLabels where applicable for accessibility?

Copy link
Member

@micahmo micahmo left a comment

Choose a reason for hiding this comment

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

This is really cool!

I tested on Android and saw similar discrepancies between what Thunder and the OS report, but I'm sure there are other things going on, like you said.

Before After
image image
image image

Somewhat related: at some point in the future I'd like to introduce an advanced setting that allows for more aggressive image caching, for those who are willing to sacrifice more memory/disk usage in favor of performance. Just throwing that out there as something I had mind. 😊

@hjiangsu
Copy link
Member Author

I tested on Android and saw similar discrepancies between what Thunder and the OS report, but I'm sure there are other things going on, like you said.

I believe its other cached/temp files that are the discrepancies in this case. I do think the image cache plays the largest role in increasing the overall app size though, which should be a huge improvement! (casually scrolling through the main feed in compact mode for a few minutes brought my cache size to over 200MB depending on the amount of images)

@hjiangsu hjiangsu merged commit 0a928f1 into develop Jan 17, 2024
1 check passed
@hjiangsu hjiangsu deleted the feature/clear-image-cache branch January 17, 2024 00:21
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