cachecontrol

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScopePublic  = Scope("PUBLIC")
	ScopePrivate = Scope("PRIVATE")
)

Variables

This section is empty.

Functions

func SetHint

func SetHint(ctx context.Context, scope Scope, maxAge time.Duration)

func WithCacheControlExtension

func WithCacheControlExtension(ctx context.Context) context.Context

Types

type CacheControl

type CacheControl struct {
	Version int    `json:"version"`
	Hints   []Hint `json:"hints"`
	// contains filtered or unexported fields
}

func GetCacheControl

func GetCacheControl(ctx context.Context) *CacheControl

func (*CacheControl) AddHint

func (cache *CacheControl) AddHint(h Hint)

func (*CacheControl) OverallPolicy

func (cache *CacheControl) OverallPolicy() OverallCachePolicy

OverallPolicy return a calculated cache policy

type Extension

type Extension struct{}

func (Extension) ExtensionName

func (c Extension) ExtensionName() string

func (Extension) InterceptResponse

func (c Extension) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response

func (Extension) Validate

func (c Extension) Validate(_ graphql.ExecutableSchema) error

type Hint

type Hint struct {
	Path   ast.Path `json:"path"`
	MaxAge float64  `json:"maxAge"`
	Scope  Scope    `json:"scope"`
}

type OverallCachePolicy

type OverallCachePolicy struct {
	MaxAge float64
	Scope  Scope
}

type Scope

type Scope string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL