Skip to content

Caching for frequently polled requests for frequently changed state (maybe use ServeDir) #2579

Answered by jplatte
yatesco asked this question in Q&A
Discussion options

You must be logged in to vote

I would recommend you to copy the parts of tower-http's ServeDir that make sense for your use case. It sounds like you wouldn't otherwise need to write files to disk, so it seems weird to do that only to be able to use ServeDir.

Though if you do want to write temporary files to disk, I can recommend the atomic-write-file crate as a way to achieve that, it pulls some neat and useful tricks beyond what you'd find in a home-grown write-with-temporary-name-then-rename implementation.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yatesco
Comment options

Answer selected by jplatte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants