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") //nolint // ErrFailedToSaveToCache will throw if the item can't be saved to cache ErrFailedToSaveToCache = errors.New("Failed to save item") //nolint // ErrCacheMissed will throw if an item can't be retrieved (due to invalid, or missing) ErrCacheMissed = errors.New("Cache is missing") //nolint // ErrStorageInternal will throw when some internal error in storage occurred ErrStorageInternal = errors.New("Internal error in storage") //nolint )
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 is the interface contract for the detail cache functionality
Click to show internal directories.
Click to hide internal directories.