Stridsvagn69420 / Cyrkensia

Music Repository Server
https://crates.io/crates/cyrkensia
GNU Affero General Public License v3.0
2 stars 0 forks source link

[Feature] Add caching for slow and/or big roots. #5

Closed Stridsvagn69420 closed 2 years ago

Stridsvagn69420 commented 2 years ago

Is your feature request related to a problem? Please describe. I had to get fast flash storage so that my request times weren't 5 seconds for just some JSON. The current solution also doesn't allow more precise SHA-256 checksums while also serving very fast. I think many would appreciate this feature too, so that they can serve many files properly without having to get faster and more expensive CPU and storage.

Describe the solution you'd like Add a global variable for the server module that get's updated in a duration set by the user. If it's 0 or not set, it will disable caching and behave just like now, so no chechksums either.
Then this variable gets updated in the set interval and the hostinfo endpoint just prints it out as a JSON string. There should also be another property that tells the client if checksums/caching is enabled, so that it can read the hash values without having to check manually if they're null/undefined.

Stridsvagn69420 commented 2 years ago

So, to implement this, I'd have to rewrite the entire thing. Seriously. Essentially, if you want a cached version, use Nginx in front of Cyrkensia. You can still use this as is, but if you struggle with high traffic and I/O, just use Nginx for caching. This wouldn't even implement caching for files anyway.