Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrStorageNotFound will throw when some not found key error in storage ErrStorageNotFound = errors.New("key is missing") // ErrStorageInternal will throw when some internal error in storage occurred ErrStorageInternal = errors.New("internal error in storage") )
View Source
var ( HeaderAuthorization = "Authorization" HeaderCacheControl = "Cache-Control" XFromHache = "X-HTTPCache" XHacheOrigin = "X-HTTPCache-Origin" )
Functions ¶
This section is empty.
Types ¶
type CacheHandler ¶
type CacheHandler struct {
// contains filtered or unexported fields
}
func NewCacheHandlerRoundtrip ¶
func NewCacheHandlerRoundtrip(roundTripper http.RoundTripper, ICache CacheInterface, webStaticFile bool) *CacheHandler
NewCacheHandlerRoundtrip will create an implementations of cache http roundtripper
type CacheInterface ¶
type CacheInterface interface {
Set(key string, value CachedResponse) error
Get(key string) (res CachedResponse, err error)
Delete(key string) error
Flush() error
}
CacheInterface implement method cache
type CachedResponse ¶
type CachedResponse struct {
Response []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) ToByte ¶
func (c CachedResponse) ToByte() []byte
type RedisCacheOptions ¶
RedisCacheOptions for storing data for Redis connections
Click to show internal directories.
Click to hide internal directories.