cache

package
v1.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheStorageInMemory = "IN-MEMORY"
	CacheRedis           = "REDIS"
)

Cache storage type

Variables

View Source
var (
	// ErrInvalidCachedResponse will throw if the cached response is invalid
	ErrInvalidCachedResponse = errors.New("Cached Response is Invalid")
	// ErrFailedToSaveToCache will throw if the item can't be saved to cache
	ErrFailedToSaveToCache = errors.New("Failed to save item")
	// ErrCacheMissed will throw if an item can't be retrieved (due to invalid, or missing)
	ErrCacheMissed = errors.New("Cache is missing")
)

Functions

This section is empty.

Types

type CachedResponse

type CachedResponse struct {
	DumpedResponse []byte    `json:"response"`      // The dumped response body
	RequestURI     string    `json:"requestUri"`    // The requestURI of the response
	RequestMethod  string    `json:"requestMethod"` // The HTTP Method that call the request for this response
	CachedTime     time.Time `json:"cachedTime"`    // The timestamp when this response is Cached
}

CachedResponse represent the cacher struct item

func (*CachedResponse) Validate

func (c *CachedResponse) Validate() (err error)

Validate will validate the cached response

type ICacheInteractor

type ICacheInteractor interface {
	Set(key string, value CachedResponse) error
	Get(key string) (CachedResponse, error)
	Delete(key string) error
	Flush() error
	Origin() string
}

ICacheInteractor ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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