Documentation
¶
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
}
func (*Cache) EvictEntry ¶ added in v15.5.0
func (*Cache) EvictExpiredEntries ¶
func (c *Cache) EvictExpiredEntries()
func (*Cache) GetOrCreateCacheEntry ¶
type CacheWithErr ¶
type CacheWithErr struct {
// contains filtered or unexported fields
}
func NewWithError ¶
func (*CacheWithErr) GetItem ¶
func (c *CacheWithErr) GetItem(ctx context.Context, key interface{}, f GetItemDirectly) (interface{}, error)
type Entry ¶
type Entry struct {
// protects state in this object.
syncz.Mutex
// Expires holds the time when this entry should be removed from the cache.
Expires time.Time
// Item is the cached item.
Item interface{}
}
func (*Entry) IsEmptyLocked ¶
func (*Entry) IsNeedRefreshLocked ¶
type ErrCacher ¶ added in v15.5.0
type ErrCacher interface {
// GetError retrieves a cached error.
// Returns nil if no cached error found or if there was a problem accessing the cache.
GetError(ctx context.Context, key interface{}) error
// CacheError puts error into the cache.
CacheError(ctx context.Context, key interface{}, err error, errTtl time.Duration)
}
type GetItemDirectly ¶
type GetItemDirectly func() (interface{}, error)
Click to show internal directories.
Click to hide internal directories.