Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache chunked responses #1

Open
tanguilp opened this issue Aug 21, 2022 · 3 comments
Open

Cache chunked responses #1

tanguilp opened this issue Aug 21, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@tanguilp
Copy link
Owner

The author hasn't find a way to cache chunked responses, as their content cannot be retrieved before sending (because sending is done directly through the adapter).

Implementing this could require some changes in the Plug library or even in adapters. A discussion with author of this libraries could be useful.

@tanguilp tanguilp added the enhancement New feature or request label Aug 21, 2022
@LostKobrakai
Copy link

There's going to be a register_before_chunk in plug 1.15 (currently only on main) elixir-plug/plug#1154

@tanguilp
Copy link
Owner Author

tanguilp commented Jul 5, 2023

Thanks for the information! Not clear yet how to accumulate these chunks to get the final response.

@tanguilp
Copy link
Owner Author

We probably don't want to accumulate chunks in memory to rebuild the response, because chunked responses are usually used to stream large responses.

Instead we should consider transforming chunks to 206 Partial Content and let http_cache cache these (unsupported right now) and even combining these chunks to rebuild the initial response (even less supported). This would be particularly interesting when disk backend is used and disk capacity surpasses largely memory capacity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants