Documentation ¶
Overview ¶
Package cache implements a simple cache where the entries are expired after a given time (5 minutes of disuse by default).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache holds values indexed by string, but expired after a given (5 minutes by default).
func (*Cache) Get ¶
func (c *Cache) Get(key string, create CreateFunc) (value interface{}, err error)
Get gets a value named key either from the cache or creates it afresh with the create function.
type CreateFunc ¶
CreateFunc is called to create new values. If the create function returns an error it will be cached if ok is true, otherwise the error will just be returned, allowing negative caching if required.
Click to show internal directories.
Click to hide internal directories.