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) EvictExpiredEntries ¶
func (c *Cache) EvictExpiredEntries()
func (*Cache) GetOrCreateCacheEntry ¶
type CacheWithErr ¶
type CacheWithErr struct {
// contains filtered or unexported fields
}
func NewWithError ¶
func NewWithError(ttl, errTtl time.Duration, errCacheStrategy ErrCacheStrategy) *CacheWithErr
func (*CacheWithErr) GetItem ¶
func (c *CacheWithErr) GetItem(ctx context.Context, key interface{}, f GetItemDirectly) (interface{}, error)
type Entry ¶
type Entry struct {
// Expires holds the time when this entry should be removed from the cache.
Expires time.Time
// Item is the cached item.
Item interface{}
// contains filtered or unexported fields
}
func (*Entry) IsEmptyLocked ¶
func (*Entry) IsNeedRefreshLocked ¶
type EntryWithErr ¶
type EntryWithErr struct {
// Item is the cached item.
Item interface{}
Err error
}
type ErrCacheStrategy ¶
ErrCacheStrategy determines whether an error is cacheable or not. Returns true if cacheable and false otherwise.
type GetItemDirectly ¶
type GetItemDirectly func() (interface{}, error)
Click to show internal directories.
Click to hide internal directories.