cache

package
v1.1.18 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func NewCache

func NewCache(
	maxAge time.Duration,
	handlerPattern string,
) *Cache

func (Cache) Count

func (c Cache) Count() int

func (Cache) Delete

func (c Cache) Delete(key string)

func (Cache) Get

func (c Cache) Get(requestBody []byte, requestParams string) (CacheEntry, bool, string)

func (Cache) GetByKey

func (c Cache) GetByKey(key string) (CacheEntry, bool)

func (Cache) HandlerPattern added in v1.1.7

func (c Cache) HandlerPattern() string

func (Cache) Keys

func (c Cache) Keys() []string

func (Cache) MaxAge

func (c Cache) MaxAge() time.Duration

func (Cache) Set

func (c Cache) Set(
	requestBody []byte,
	requestParams string,
	requestHeader http.Header,
	responseModel interface{},
	responseHeader http.Header,
	responseStatusCode int,
	responseBodyPlain []byte,
	responseBodyBrotli []byte,
	responseBodyGzip []byte,
	responseBodyDeflate []byte,
)

func (Cache) Size

func (c Cache) Size() uint64

type CacheEntry added in v1.0.85

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

func (*CacheEntry) Clone added in v1.0.85

func (e *CacheEntry) Clone() CacheEntry

func (CacheEntry) EstimatedSize added in v1.1.7

func (e CacheEntry) EstimatedSize() uint64

func (*CacheEntry) ResponseBodyBrotli added in v1.0.85

func (e *CacheEntry) ResponseBodyBrotli() []byte

func (*CacheEntry) ResponseBodyDeflate added in v1.0.85

func (e *CacheEntry) ResponseBodyDeflate() []byte

func (*CacheEntry) ResponseBodyGzip added in v1.0.85

func (e *CacheEntry) ResponseBodyGzip() []byte

func (*CacheEntry) ResponseBodyPlain added in v1.0.87

func (e *CacheEntry) ResponseBodyPlain() []byte

func (*CacheEntry) ResponseHeader added in v1.0.85

func (e *CacheEntry) ResponseHeader() http.Header

func (*CacheEntry) ResponseModel added in v1.0.85

func (e *CacheEntry) ResponseModel() interface{}

func (*CacheEntry) ResponseStatusCode added in v1.0.85

func (e *CacheEntry) ResponseStatusCode() int

func (CacheEntry) Stats added in v1.1.7

func (e CacheEntry) Stats(c *Cache) (CacheEntryStats, error)

func (*CacheEntry) String added in v1.0.85

func (e *CacheEntry) String() string

func (*CacheEntry) UpdatedOn added in v1.0.85

func (e *CacheEntry) UpdatedOn() time.Time

type CacheEntryStats added in v1.1.7

type CacheEntryStats struct {
	UpdatedOn          string     `json:"updatedOn"`
	TTL                string     `json:"TTL"`
	EstimatedSize      string     `json:"estimatedSize"`
	EstimatedSizeBytes uint64     `json:"estimatedSizeBytes"`
	StatusCode         int        `json:"statusCode"`
	CachedModel        bool       `json:"cachedModel"`
	CachedBodyPlain    bool       `json:"cachedBodyPlain"`
	CachedBodyBrotli   bool       `json:"cachedBodyBrotli"`
	CachedBodyGzip     bool       `json:"cachedBodyGzip"`
	CachedBodyDeflate  bool       `json:"cachedBodyDeflate"`
	RequestParams      url.Values `json:"requestParams"`
	RequestBody        string     `json:"requestBody"`
}

Jump to

Keyboard shortcuts

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