Documentation ¶
Index ¶
- Variables
- type Cache
- func (c *Cache) Delete(key interface{}) bool
- func (c *Cache) Get(key interface{}) (interface{}, bool)
- func (c *Cache) Load(ctx context.Context, key interface{}) (interface{}, error)
- func (c *Cache) Peek(key interface{}) (interface{}, bool)
- func (c *Cache) Set(key interface{}, value interface{}, expireTime time.Time) bool
- type Loader
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound is returned when Loader returns a nil or expired value. ErrNotFound = errors.New("cache entry not found") // NoExpireTime disables expire time for a given value. NoExpireTime time.Time // NoValue is a value a Loader can return to cache a nil. NoValue noValue = struct{}{} )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is an LRU cache with cache filling functionality.
func (*Cache) Load ¶
Load looks up a key's value from the cache or populates it from Loader if not found.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
singleflight
Package singleflight provides a duplicate function call suppression mechanism.
|
Package singleflight provides a duplicate function call suppression mechanism. |
Click to show internal directories.
Click to hide internal directories.