express-redis-cache icon indicating copy to clipboard operation
express-redis-cache copied to clipboard

Support caching streamed responses (res.write, res.end)

Open fikander opened this issue 7 years ago • 7 comments

Accumulate content in a buffer on res.write. Save the buffer as cache on res.end

fikander avatar Jul 10 '17 21:07 fikander

Did this make it anywhere?

smulder avatar Jan 10 '18 13:01 smulder

It hasn't been merged, but this branch is being used in prod in our project.

fikander avatar Jan 10 '18 13:01 fikander

Before I bug you to much for a peak at some code... do you think it would support Marko templates (if your familiar) they require a writeable stream as their out and don’t call send on res. Not sure what is called to actually finish the send, but I don’t remember end being fired on res either.

smulder avatar Jan 10 '18 13:01 smulder

Also, did you end up working to remove domain from your version by any chance?

smulder avatar Jan 10 '18 13:01 smulder

@smulder sorry I don't know what Marko templates are. I didn't remove domain.

fikander avatar Jan 10 '18 19:01 fikander

I just ported your code over to my copy and it works excellent, puts the easy middleware use back in my situation rather than having to custom code each route.

Thank you for doing that, bummer they never merged it!

smulder avatar Jan 10 '18 19:01 smulder

Perfect. Glad it worked for you. I was surprised it wasn't there in the first place - looks like a common scenario.

fikander avatar Jan 10 '18 19:01 fikander