Automatic clearing of audio cache #2
Locked
amd64fox
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Warning
The method is outdated as I have switched to another.
What cache are we talking about?
Basically, we are talking about the cache, which is located in this folder
Local\Spotify\Data
. It is there that the files from the music you listened to are stored and accumulated. On the one hand, the cache allows you to speed up the application, but on the other hand, for some reason, the developers decided not to self-clean these files.For example, if I listen to music in my style for a week, then there will be approximately 2 to 4 GB of cache, and this will only be the cache from the music being listened to. There are other kinds of cache in the application, but they don't use as much space as this one. For example, there is a cache from the Chrome browser on which the client is based, located here
AppData\Local\Spotify\Browser
, but there Google took care and built its own cache clearing, so there are no problems with this cache at all.There are a couple more places under surveillance that could potentially accumulate without cleaning, but so far there is no complete certainty. If you have any comments and observations on this cache topic, please share your experience in the comments.
About the script
Powershell-based script, deletes the cache from the music you listened to on the basis of the last access to files (lastaccesstime), this means that if the Spotify client uses the cache file or modifies it, it thereby resets its deletion period. Files that have not been used or changed during the set period are deleted. (The default deletion period is set by you when installing the patch, this value can be changed at any time)
In general, in simple words, if the cache file is used, then it will not be deleted, thereby we accumulate only the useful cache, and delete the useless one.
The cache is self-cleaned according to this rule:
Local\Spotify\Data
The deletion thresholds can be selected to your taste, everything changes in the
cache-spotify.ps1
file located in theAppData\Roaming\Spotify\cache\
folder. I commented out the main blocks in the code, it's very easy to figure it out.The self-cleaning script has a launch trigger to turn off the Spotify client, provided that you started it through a shortcut on the desktop or through a shortcut from the start menu, that is, it checks the cache for the conditions specified above after each shutdown of the client and clears it if necessary. You can also see a short log of the cleaning script, it is in the file
log.txt
in the same folder.Beta Was this translation helpful? Give feedback.
All reactions