Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAdapter ¶
func NewAdapter(opts ...AdapterOptions) (cache.Adapter, error)
NewAdapter initializes memory adapter.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter is the memory adapter data structure.
func (*Adapter) Purge ¶
func (a *Adapter) Purge()
Purge implements the Adapter interface Purge method
type AdapterOptions ¶
AdapterOptions is used to set Adapter settings.
func AdapterWithAlgorithm ¶
func AdapterWithAlgorithm(alg Algorithm) AdapterOptions
AdapterWithAlgorithm sets the approach used to select a cached response to be evicted when the capacity is reached.
func AdapterWithCapacity ¶
func AdapterWithCapacity(cap int) AdapterOptions
AdapterWithCapacity sets the maximum number of cached responses.
type Response ¶ added in v1.0.3
type Response struct { // Value is the cached response value. Value []byte // Expiration is the cached response expiration date. Expiration time.Time // LastAccess is the last date a cached response was accessed. // Used by LRU and MRU algorithms. LastAccess time.Time // Frequency is the count of times a cached response is accessed. // Used for LFU and MFU algorithms. Frequency int }
func BytesToResponse ¶ added in v1.0.3
BytesToResponse converts bytes array into Response data structure.
Click to show internal directories.
Click to hide internal directories.