Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Discards the least recently used items first. LRU evictionPolicy = iota // Discards the least frequently used items first. LFU )
Variables ¶
View Source
var ErrNotFound = errors.New("key not found")
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// Set inserts or updates the specified key-value pair with an expiration time.
Set(key string, value interface{}, expiry time.Duration) error
// Get returns the value for specified key if it is present in the cache.
Get(key string) (interface{}, error)
}
Cache is common interface of cache.
type LFUCache ¶
type LFUCache struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.