cache

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

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

Types

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 ICache added in v1.9.1

type ICache interface {
	Get(key string) ([]byte, bool)
	Set(key string, data []byte)
	Clear()
}

type ObservableCache added in v1.9.1

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

func NewObservableCache added in v1.9.1

func NewObservableCache(cfg Config, observer *bus.Observer) *ObservableCache

func (*ObservableCache) Clear added in v1.9.1

func (c *ObservableCache) Clear()

func (*ObservableCache) Close added in v1.9.1

func (c *ObservableCache) Close() error

func (*ObservableCache) Get added in v1.9.1

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

func (*ObservableCache) Set added in v1.9.1

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

func (*ObservableCache) Start added in v1.9.1

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

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)

type TTLCache added in v1.9.1

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

func NewTTLCache added in v1.9.1

func NewTTLCache(expiration time.Duration) (*TTLCache, error)

func (*TTLCache) Clear added in v1.9.1

func (c *TTLCache) Clear()

func (*TTLCache) Close added in v1.9.10

func (c *TTLCache) Close() error

func (*TTLCache) Get added in v1.9.1

func (c *TTLCache) Get(key string) (data []byte, found bool)

func (*TTLCache) Set added in v1.9.1

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

Jump to

Keyboard shortcuts

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