cache

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(cache *Cache, skipper middleware.Skipper) echo.MiddlewareFunc

Types

type Cache

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

func NewCache

func NewCache(cfg Config, observer *bus.Observer) *Cache

func (*Cache) Clear

func (c *Cache) Clear()

func (*Cache) Close

func (c *Cache) Close() error

func (*Cache) Get

func (c *Cache) Get(key string) ([]byte, bool)

func (*Cache) Set

func (c *Cache) Set(key string, data []byte)

func (*Cache) Start

func (c *Cache) Start(ctx context.Context)

type CacheEntry

type CacheEntry struct {
	Header     http.Header
	StatusCode int
	Body       []byte
}

func (*CacheEntry) Decode

func (c *CacheEntry) Decode(b []byte) error

func (*CacheEntry) Encode

func (c *CacheEntry) Encode() ([]byte, error)

func (*CacheEntry) Replay

func (c *CacheEntry) Replay(w http.ResponseWriter) error

type CacheMiddleware

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

func (*CacheMiddleware) Handler

func (m *CacheMiddleware) Handler(next echo.HandlerFunc) echo.HandlerFunc

type Config

type Config struct {
	MaxEntitiesCount int
}

type ResponseRecorder

type ResponseRecorder struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func NewResponseRecorder

func NewResponseRecorder(w http.ResponseWriter) *ResponseRecorder

func (*ResponseRecorder) Result

func (r *ResponseRecorder) Result() *CacheEntry

func (*ResponseRecorder) Write

func (w *ResponseRecorder) Write(b []byte) (int, error)

func (*ResponseRecorder) WriteHeader

func (w *ResponseRecorder) WriteHeader(statusCode int)

Jump to

Keyboard shortcuts

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