Fiber: 馃殌 Better Integration between cache and compress

Created on 4 Dec 2020  路  1Comment  路  Source: gofiber/fiber

Problem
When the cache middleware is used with the compress middleware, cached responses need to be re-compressed on every request. This adds 30-60ms latency on my machine for compressing cached responses.

// responese are cached uncompressed, and are compressed on-the-fly on each request
app.Use(compress.New(), cache.New())

The code below does not work because cache middleware does not know how to cache compressed content nor does it cache response headers such as Content-Encoding

app.Use(cache.New(), compress.New())

Suggested Solution
It would be nice to have a better integration between the two middleware handlers so that cached responses are pre-compressed.

鈽笍 Bug 馃彿 Wait for Release

Most helpful comment

The cache middleware does not check for the content encoding header, I fixed this in https://github.com/gofiber/fiber/pull/1054
Expect a version tag today or tomorrow 馃憤

>All comments

The cache middleware does not check for the content encoding header, I fixed this in https://github.com/gofiber/fiber/pull/1054
Expect a version tag today or tomorrow 馃憤

Was this page helpful?
0 / 5 - 0 ratings