librespot icon indicating copy to clipboard operation
librespot copied to clipboard

Limit cache size

Open giannello opened this issue 8 years ago • 6 comments

For people running librespot on hardware with limited resources, it would be nice to have an option to limit the cache size.

giannello avatar Jul 29 '16 19:07 giannello

This is definitely something I'd like to have, but requires quite a bit of work. At the moment, caching is just a matter of placing the file in the cache directory, and trying to open it when loading.

This requires some bookkeeping to keep track of what files are in the cache, their size, along with an eviction algorithm.

These could be used as inspiration, although librespot doesn't need something as sophisticated : https://wiki.mozilla.org/Necko/Cache https://www.chromium.org/developers/design-documents/network-stack/disk-cache

plietar avatar Jul 29 '16 20:07 plietar

For the moment, users that face issues with it, they could make a simple cron-job that checks the atime of files tp clean-up.

mfonville avatar Nov 29 '16 14:11 mfonville

@mfonville how is this possible? If I run find /tmp/librespot/files/* -atime +2 -exec rm {} \; it crashes librespot. The only way I can get it to work is to stop the librespot service, clear up the files and start it again. If I do this, the music will stop when playing, so it doesn't seem to be the most ideal solution yet :)

juriansluiman avatar Feb 22 '17 13:02 juriansluiman

@juriansluiman Deleting files while librespot is running should work. Can you run librespot with RUST_BACKTRACE=1 and --verbose and post the log please ? What platform are you running on ?

plietar avatar Feb 22 '17 14:02 plietar

@plietar sorry, you get forget my comment. I was having another issue with librespot so it stopped working, but just tried again and it does continue to play. My bad!

juriansluiman avatar Feb 22 '17 15:02 juriansluiman

I've modified librespot to disable the audio file-cache. See pull request #181.

michaelherger avatar May 02 '17 04:05 michaelherger