Documentation ¶
Index ¶
- Constants
- type Loader
- func (ld *Loader) Contains(ctx context.Context, key string) bool
- func (ld *Loader) Errors() int64
- func (ld *Loader) Hits() int64
- func (ld *Loader) Load(ctx context.Context, key string) (interface{}, error)
- func (ld *Loader) Misses() int64
- func (ld *Loader) Ratio() float64
- func (ld *Loader) Remove(ctx context.Context, key string)
- func (ld *Loader) Stats() string
- func (ld *Loader) Update(ctx context.Context, key string, value interface{}) error
- type LoaderFunc
Constants ¶
View Source
const ( // DefaultTTL is the default TTL used if nothing else is specified DefaultTTL = time.Minute * 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader holds cached resources. The cache is a simple in-memory cache with TTL.
func (*Loader) Load ¶
Load returns either a cached resource or calls the loader function to retrieve the requested resource
Click to show internal directories.
Click to hide internal directories.