rx-angular icon indicating copy to clipboard operation
rx-angular copied to clipboard

feat(isr): Compression

Open maxisam opened this issue 1 year ago • 4 comments
trafficstars

Problem Solved By The Feature

The size of the page could be really big without compression.

Solution

Add an option to store cache html as compressed and return with compressed html and compress header directly

Additional Context

Since we have lots of pages and size are pretty big as well. With compress, it makes the whole process more efficiently like the traffic between redis and return the compressed html directly.

maxisam avatar Aug 22 '24 22:08 maxisam

Should we make the compression pluggable? So the users can provide their own compression? I'd like to have this as a config that they can provide a compress function, this way they can use whatever they need to do with it.

eneajaho avatar Aug 23 '24 21:08 eneajaho

That is a great idea. I will see if I can make it.

maxisam avatar Aug 24 '24 04:08 maxisam

Just realized I need to add another change to this PR. Currently cache handler take string as value. But with compress function, it should take Buffer as value. so the value could be either Buffer or String, it will only be Buffer if compress feature is enabled.

Buffer to Base64 string could grow as much as 40% in size.

I feel like it shouldn't count as breaking change, since it is more like it can accept either way.

maxisam avatar Oct 10 '24 05:10 maxisam

on the other hands, Angular 19 is coming, maybe we just catch this chance and push to v19 😆

maxisam avatar Oct 10 '24 15:10 maxisam