Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoSuchKey = errors.New("there's no such key existing in cache")
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // Set puts key and value into cache. // First parameter for extra should be time.Time object denoting expected survival time. // If survival time equals 0 or less, the key will always be survival. Set(key string, value bool, extra ...interface{}) error // Get returns result for key, // If there's no such key existing in cache, // ErrNoSuchKey will be returned. Get(key string) (bool, error) // Delete will remove the specific key in cache. // If there's no such key existing in cache, // ErrNoSuchKey will be returned. Delete(key string) error // Clear deletes all the items stored in cache. Clear() error }
func NewDefaultCache ¶
func NewSyncCache ¶
type DefaultCache ¶
type DefaultCache map[string]cacheItem
func (*DefaultCache) Clear ¶
func (c *DefaultCache) Clear() error
func (*DefaultCache) Delete ¶
func (c *DefaultCache) Delete(key string) error
Click to show internal directories.
Click to hide internal directories.