cachekit

package
v0.9.21 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HeaderCacheControl as in https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
	HeaderCacheControl = "Cache-Control"
	// HeaderExpires as in https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires
	HeaderExpires = "Expires"
	// HeaderLastModified as in https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified
	HeaderLastModified = "Last-Modified"
	// HeaderIfModifiedSince as in https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since
	HeaderIfModifiedSince = "If-Modified-Since"
)

Variables

This section is empty.

Functions

func FormatTime

func FormatTime(t time.Time) string

FormatTime format time

func ParseTime

func ParseTime(raw string) time.Time

ParseTime parse time

Types

type CacheData added in v0.9.10

type CacheData struct {
	LastModified string
	Body         []byte
	Head         Head
}

CacheData cache data

type Head struct {
	StatusCode int
	Header     http.Header
}

Head ...

type Pragma

type Pragma struct {
	IfModifiedSince time.Time
	LastModified    time.Time
	NoCache         bool
	MaxAge          time.Duration
	Expires         time.Time
}

Pragma handle pragmatic information/directives for caching

func CreatePragma

func CreatePragma(header http.Header) *Pragma

CreatePragma to create new instance of CacheControl from request

func (*Pragma) Header added in v0.9.9

func (c *Pragma) Header() http.Header

Header set header

func (*Pragma) String

func (c *Pragma) String() string

type Store

type Store struct {
	*redis.Client
	DefaultMaxAge time.Duration
	PrefixKey     string
}

Store ...

func (*Store) Middleware

func (s *Store) Middleware(next echo.HandlerFunc) echo.HandlerFunc

Middleware ...

Jump to

Keyboard shortcuts

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