func CacheManagement(cfg *config.CacheConfig) func(http.Handler) http.Handler {
	return func(h http.Handler) http.Handler {
		return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
			// Check if expires header is set
			if cfg.Expires != "" {
				rw.Header().Set("Expires", cfg.Expires)
			}
			// Check if cache control is set
			if cfg.CacheControl != "" {
				rw.Header().Set("Cache-Control", cfg.CacheControl)
			}
			// Check if pragma is set
			if cfg.Pragma != "" {
				rw.Header().Set("Pragma", cfg.Pragma)
			}
			// Check if x-accel-expires
			if cfg.XAccelExpires != "" {
				rw.Header().Set("X-Accel-Expires", cfg.XAccelExpires)
			}

			// Next
			h.ServeHTTP(rw, r)
		})
	}
}
// CacheManagement is a middleware to manage cache header output.
CacheManagement is a middleware to manage cache header output.
// CacheManagement is a middleware to manage cache header output .
func CacheManagement(cfg *config.CacheConfig) func(http.Handler) http.Handler {
	return func(h http.Handler) http.Handler {
		return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
			if cfg.Expires != "" {
				rw.Header().Set("Expires", cfg.Expires)
			}
			if cfg.CacheControl != "" {
				rw.Header().Set("Cache-Control", cfg.CacheControl)
			}
			if cfg.Pragma != "" {
				rw.Header().Set("Pragma", cfg.Pragma)
			}
			if cfg.XAccelExpires != "" {
				rw.Header().Set("X-Accel-Expires", cfg.XAccelExpires)
			}
			h.ServeHTTP(rw, r)
		})
	}
}
func CacheManagement ( cfg * config . CacheConfig ) func ( http . Handler ) http . Handler { return func ( h http . Handler ) http . Handler { return http . HandlerFunc ( func ( rw http . ResponseWriter , r * http . Request ) { if cfg . Expires != " " { rw . Header ( ) . Set ( " " , cfg . Expires ) } if cfg . CacheControl != " " { rw . Header ( ) . Set ( " " , cfg . CacheControl ) } if cfg . Pragma != " " { rw . Header ( ) . Set ( " " , cfg . Pragma ) } if cfg . XAccelExpires != " " { rw . Header ( ) . Set ( " " , cfg . XAccelExpires ) } h . ServeHTTP ( rw , r ) } ) } }
CacheManagement is a middleware to manage cache header output.
CacheManagement is a middleware to manage cache header output .
// Check if expires header is set // Check if cache control is set // Check if pragma is set // Check if x-accel-expires // Next