Documentation ¶
Index ¶
- type Entry
- type Pool
- type Response
- func (r *Response) Body() []byte
- func (r *Response) Bytes() []byte
- func (r *Response) Headers() http.Header
- func (r *Response) Read(b []byte) (int, error)
- func (r *Response) SetBody(body []byte)
- func (r *Response) SetHeaders(h http.Header)
- func (r *Response) SetStatusCode(statusCode int)
- func (r *Response) StatusCode() int
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct { // when `Reset` this value is reseting to time.Now(), // it's used to send the "Last-Modified" header, // some clients may need it. LastModified time.Time // contains filtered or unexported fields }
Entry is the cache entry contains the expiration datetime and the response
type Pool ¶ added in v12.2.8
type Pool struct {
// contains filtered or unexported fields
}
Pool is the context pool, it's used inside router and the framework by itself.
func NewPool ¶ added in v12.2.8
func NewPool() *Pool
NewPool creates and returns a new context pool.
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response is the cached response will be send to the clients its fields set at runtime on each of the non-cached executions non-cached executions = first execution, and each time after cache expiration datetime passed.
func NewResponse ¶ added in v12.2.8
NewResponse returns a new cached Response.
func (*Response) SetBody ¶ added in v12.2.8
SetBody consumes "b" and sets the body of the cached response.
func (*Response) SetHeaders ¶ added in v12.2.8
SetHeaders sets a clone of headers of the cached response.
func (*Response) SetStatusCode ¶ added in v12.2.8
SetStatusCode sets a valid status code.
func (*Response) StatusCode ¶
StatusCode returns a valid status code.
type Store ¶ added in v12.2.8
type Store interface { // Get returns an entry based on its key. Get(key string) *Entry // Set sets an entry based on its key. Set(key string, e *Entry) // Delete deletes an entry based on its key. Delete(key string) }
Store is the interface which is responsible to store the cache entries.
func NewMemStore ¶ added in v12.2.8
func NewMemStore() Store
NewMemStore returns a new in-memory store for the cache entries.