Skip to content

Latest commit

 

History

History

goyave

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Goyave middleware: Souin

This is a distributed HTTP cache module for Goyave based on Souin cache.

Features

Example

There is the example about the Souin initialization.

import (
	"net/http"

	cache "github.com/darkweak/souin/plugins/goyave"
	"goyave.dev/goyave/v4"
)

func main() {
	// ...
	goyave.Start(func(r *goyave.Router) {
		r.GlobalMiddleware(cache.NewHTTPCache(cache.DevDefaultConfiguration).Handle)
		// ...
	})
}

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 Goyave 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 goyave middleware