Documentation ¶
Overview ¶
Package cache implements a simple time-outable cache
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTimeoutExpired is the error returned along with the value when the timeout // for the value has expired ErrTimeoutExpired = errors.New("timeout expired, value may be invalid now") // ErrWrongType is the error returned when the value could not be typecast // into the requested type ErrWrongType = errors.New("the value does not conform to the requested type") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache represents a simple safe
func (*Cache) Read ¶
ReadCache returns the value of the cache for key k. If the value has expeired, it also returns the ErrTimeoutExpired error
func (*Cache) ReadString ¶
ReadString returns the value of the cache for key k typecast into a string. If it cannot be typecast, it will return ErrWrongType. The method will return an ErrTimeoutExpired if appropriate and the typecast succeeded
Click to show internal directories.
Click to hide internal directories.