[FEATURE REQUEST] Add an HTTP cache middleware
- Dominant language
- Go
- Stars
- 25.6k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**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
```go
app := iris.New()
// c is a configuration object
app.Use(iris.NewHTTPCache(c))
app.Get("/", func(ctx iris.Context) {
ctx.HTML("Hello %s!", "World")
})
app.Listen(":8080")
```
Let me know about your opinion about that ✌️
Contributor guide
Assessment
This issue has not been assessed yet.