cache

package
v0.0.0-...-7d1968b Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// REQ The client is unwilling to accept a response whose age is greater than the specified number of seconds.
	// RES The response is to be considered stale after its age is greater than the specified number of seconds.
	DirectiveMaxAge = "max-age"
	// REQ The client is willing to accept a response whose freshness lifetime is no less than its current age plus the specified time in seconds.
	// The client wants a response that will still be fresh for at least the specified number of seconds.
	DirectiveMinFresh = "min-fresh"
	// REQ/RES The cache MUST NOT store any part of either this request or any response to it.
	DirectiveNoStore = "no-store"
	// REQ/RES The cache MUST NOT use a stored response to satisfy the request.
	DirectiveNoCache = "no-cache"
	// RES The cache MAY store the response, even if the response would normally be non-cacheable.
	DirectivePublic = "public"
)
View Source
const (
	MaxTTL     = time.Minute * 5
	DefaultTTL = time.Minute * 1
)

Variables

This section is empty.

Functions

func Enable

func Enable(cache Cache) httpcli.HandlerFunc

Types

type Cache

type Cache interface {
	Get(key string) (value interface{}, ok bool)
	Set(key string, value interface{}, ttl time.Duration)
	Delete(key string)
}

Jump to

Keyboard shortcuts

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