SwiftcordApp / Swiftcord

A fully native Discord client for macOS built 100% in Swift!

Home Page:https://swiftcordapp.github.io/Swiftcord/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Enhancement]: Clean cache feature in Settings

Jerry23011 opened this issue · comments

Describe Your Request

Swiftcord generates cache at ~/Library/Containers/io.cryptoalgo.swiftcord. Perhaps a button in Settings to clean it would be great.

Category

Settings

Other Category

No response

Screenshots

截屏2023-05-11 12 38 44

Deleting the whole sandbox container folder (at ~/Library/Containers/io.cryptoalgo.swiftcord) might lead to unexpected consequences (since it stores quite a bit more than caches lol). The bulk of the storage is used by ~/Library/Containers/io.cryptoalgo.swiftcord/Data/Library/Caches, which is probably safe to delete, but I'm not sure if it would lead to inconsistent behaviour if the whole folder is simply deleted. Also, macOS automatically purges these cache folders in a safe fashion when low on storage (another benefit of being a native app), so there is little benefit to deleting them proactively.

The caches mostly store image data (e.g. profile images and server icons), and is limited to 100MB 256MB (so the oldest images will be deleted when the limit is hit), so it is fairly beneficial to simply keep the cache around.

Also, the cache is crucial to smooth message history scrolling. Without it, reloading every profile image and media every time they scroll into view causes poor performance. And as such, you'll notice that the cache folder quickly grows (capped at 100MB 256MB) after being cleared, especially if many messages are loaded.

However since there is interest for such an option (and it doesn't seem too hard to implement), I'll probably implement a "clear image cache" button.

So there is a limit, I didn't know 😂
I'm just afraid that it'll eventually pile up to several gigabytes, lol