Something went wrong. Try again.
forked from darkweak/souin
Something went wrong. Try again.
README.md
Goa middleware: Souin #
This is a distributed HTTP cache module for Goa based on Souin cache.
Features #
- RFC 7234 compliant HTTP Cache.
- Sets the
Cache-StatusHTTP Response Header - REST API to purge the cache and list stored resources.
- Builtin support for distributed cache.
- Tag-based invalidation.
Example #
There is the example about the Souin initialization.
import (
"net/http"
httpcache "github.com/darkweak/souin/plugins/goa"
goahttp "goa.design/goa/v3/http"
)
func main(){
// ...
g := goahttp.NewMuxer()
g.Use(httpcache.NewHTTPCache(httpcache.DevDefaultConfiguration))
// ...
}
With that your application will be able to cache the responses if possible and returns at least the Cache-Status HTTP header with the different directives mentionned in the RFC specification.
You have to pass a Goa Configuration structure into the NewHTTPCache method (you can use the DefaultConfiguration variable to have a built-in production ready configuration).
See the full detailled configuration names here.
Other resources #
You can find an example for a docker-compose stack inside the examples folder.
See the Souin configuration for the full configuration, and its associated development goa middleware