Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ItemPool is a pool of Item values. ItemPool = sync.Pool{ New: func() any { return &Item{} }, } )
Functions ¶
This section is empty.
Types ¶
type Item ¶ added in v0.1.3
type Item struct { Key string // key of the item Value any // Value of the item Size int64 // Size of the item, in bytes Expiration time.Duration // Expiration duration of the item LastAccess time.Time // LastAccess time of the item AccessCount uint // AccessCount of times the item has been accessed }
Item is a struct that represents an item in the cache. It has a key, value, expiration duration, and a last access time field.
func (*Item) Expired ¶ added in v0.1.3
Expired returns true if the item has expired, false otherwise.
type SortingField ¶
type SortingField string
SortingField is a type that represents the field to sort the cache items by.
const ( SortByKey SortingField = "Key" // Sort by the key of the cache item SortBySize SortingField = "Size" // Sort by the size in bytes of the cache item SortByLastAccess SortingField = "LastAccess" // Sort by the last access time of the cache item SortByAccessCount SortingField = "AccessCount" // Sort by the number of times the cache item has been accessed SortByExpiration SortingField = "Expiration" // Sort by the expiration duration of the cache item )
Constants for the different fields that the cache items can be sorted by.
func (SortingField) String ¶
func (f SortingField) String() string
String returns the string representation of the SortingField.
type Stat ¶ added in v0.0.4
type Stat string
Stat is a type that represents a different stat values that can be collected by the stats collector.
const ( // StatIncr represent a stat that should be incremented StatIncr Stat = "incr" // StatDecr represent a stat that should be decremented StatDecr Stat = "decr" // StatTiming represent a stat that represents the time it takes for an event to occur StatTiming Stat = "timing" // StatGauge represent a stat that represents the current value of a statistic StatGauge Stat = "gauge" // StatHistogram represent a stat that represents the statistical distribution of a set of values StatHistogram Stat = "histogram" )
Click to show internal directories.
Click to hide internal directories.