reqcache

package
v0.0.0-...-58c2bd7 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GlobalCacheAge = 5
	ErrNotCached   = errors.New("not cached")
)

var (

EmptyResp = http.Response{}

)

Functions

func ReqcacheReq

func ReqcacheReq(method string, url string, body io.Reader) (http.Request, error)

Types

type Cache

type Cache map[string]CachedReq
var GlobalCache Cache = Cache{}

type CachedReq

type CachedReq struct {
	ReqResp
}

type Req

type Req http.Request

func (Req) GetRID

func (req Req) GetRID() string

func (Req) NewReqResp

func (req Req) NewReqResp(resp http.Response) ReqResp

type ReqResp

type ReqResp struct {
	Rid     string
	Pending bool
	Resp    http.Response
	Time    time.Time
	Body    []byte
	Header  http.Header
}

func Reqcache

func Reqcache(req http.Request) (ReqResp, error)

func (ReqResp) GetCacheFile

func (reqresp ReqResp) GetCacheFile() (string, error)

func (ReqResp) ReadCache

func (reqresp ReqResp) ReadCache() (ReqResp, error)

func (ReqResp) String

func (reqresp ReqResp) String() string

func (ReqResp) ValidAge

func (reqresp ReqResp) ValidAge(CacheAge int) bool

func (ReqResp) WriteCache

func (reqresp ReqResp) WriteCache() error

Jump to

Keyboard shortcuts

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