[FEATURE REQUEST] Add an HTTP cache middleware
Is your feature request related to a problem? Please describe. Hello, I think having an HTTP cache to not let the users implement by themselves and maintain this code could be good. With that, they could use the default iris distribution, cache the responses and serve that cached response before any other business logic. It will respect the full RFC with new ones (the cache-status and the targeted cache-control RFCs).
Describe the solution you'd like I already wrote a middleware for caddy (https://github.com/caddyserver/cache-handler) and other reverse-proxies/http-servers/APIM and it's based on the Souin HTTP cache project (https://github.com/darkweak/souin). With that it will support the RFC, implement the ESI processor to parse the esi templates and provide an API to manage the cached responses.
Describe alternatives you've considered I didn't find any alternative for that
Additional context I think it will be used like that
app := iris.New()
// c is a configuration object
app.Use(iris.NewHTTPCache(c))
app.Get("/", func(ctx iris.Context) {
ctx.HTML("Hello <strong>%s</strong>!", "World")
})
app.Listen(":8080")
Let me know about your opinion about that ✌️
Hello @darkweak,
We have a cache package and examples. However, I see your point. That's totally different and we can implement it for Iris too, it's not so hard (it would take less than 20 minutes as I reviewed the code) but it's not really necessary as you can just use the iris.FromStd function to wrap the SouinCaddyMiddleware.ServeHTTP and register using Use/UseRouter. Tell me if that works for you or we need to think something else please.