httpcache

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultKey

func DefaultKey(req *http.Request) string

func NoHeadersKey

func NoHeadersKey(req *http.Request) string

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache(rt http.RoundTripper, key HTTPKey, cacher Cacher) *Cache

func (*Cache) RoundTrip

func (h *Cache) RoundTrip(req *http.Request) (*http.Response, error)

type Cacher

type Cacher interface {
	Get(string) (interface{}, bool)
	Set(string, interface{}) error
	Len() int
	Close() error
}

type HTTPKey

type HTTPKey func(*http.Request) string

type LRUCache

type LRUCache struct {
	*tinylru.LRU
}

func NewLRUCache

func NewLRUCache(size int) *LRUCache

func (*LRUCache) Close

func (c *LRUCache) Close() error

func (*LRUCache) Get

func (c *LRUCache) Get(key string) (interface{}, bool)

func (*LRUCache) Len

func (c *LRUCache) Len() int

func (*LRUCache) Set

func (c *LRUCache) Set(key string, value interface{}) error

type TTLCache

type TTLCache struct {
	// contains filtered or unexported fields
}

func NewTTLCache

func NewTTLCache(size int, d time.Duration) *TTLCache

func (*TTLCache) Close

func (c *TTLCache) Close() error

func (*TTLCache) Get

func (c *TTLCache) Get(key string) (interface{}, bool)

func (*TTLCache) Len

func (c *TTLCache) Len() int

func (*TTLCache) Set

func (c *TTLCache) Set(key string, value interface{}) error

func (*TTLCache) SkipExtension

func (c *TTLCache) SkipExtension(ok bool)

Jump to

Keyboard shortcuts

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