cache

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchMetadata

func FetchMetadata(domainID string, method string, url url.URL) ([]string, error)

FetchMetadata - Returns the cache metadata for the requested URL.

func GetVary

func GetVary(headers http.Header) ([]string, error)

GetVary - Returns the content from the Vary HTTP header.

func PurgeMetadata

func PurgeMetadata(domainID string, url url.URL) error

PurgeMetadata - Purges the cache metadata for the requested URL.

func StorageKey

func StorageKey(method string, url url.URL, meta []string, reqHeaders http.Header) string

StorageKey - Returns the cache key for the requested URL.

func StoreMetadata

func StoreMetadata(domainID string, method string, url url.URL, meta []string, expiration time.Duration) (bool, error)

StoreMetadata - Saves the cache metadata for the requested URL.

Types

type CacheObj

type CacheObj struct {
	AllowedStatuses []int
	AllowedMethods  []string
	CurrentObj      URIObj
	DomainID        string
}

CacheObj - Contains cache settings and current cached/cacheable object.

func (CacheObj) IsMethodAllowed

func (c CacheObj) IsMethodAllowed() bool

IsMethodAllowed - Checks if a HTTP method is allowed to be cached.

func (CacheObj) IsStatusAllowed

func (c CacheObj) IsStatusAllowed() bool

IsStatusAllowed - Checks if a status code is allowed to be cached.

func (CacheObj) IsValid

func (c CacheObj) IsValid() (bool, error)

IsValid - Verifies the validity of a cacheable object.

func (CacheObj) PurgeFullPage

func (c CacheObj) PurgeFullPage(method string, url url.URL) (bool, error)

PurgeFullPage - Deletes the whole page response from cache.

func (*CacheObj) RetrieveFullPage

func (c *CacheObj) RetrieveFullPage(method string, url url.URL, reqHeaders http.Header) error

RetrieveFullPage - Retrieves the whole page response from cache.

func (CacheObj) StoreFullPage

func (c CacheObj) StoreFullPage(expiration time.Duration) (bool, error)

StoreFullPage - Stores the whole page response in cache.

type URIObj

type URIObj struct {
	URL             url.URL
	Host            string
	Method          string
	StatusCode      int
	RequestHeaders  http.Header
	ResponseHeaders http.Header
	Content         [][]byte
}

URIObj - Holds details about the response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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