Documentation ¶
Index ¶
- func HandleByErr(_ *cache.Item, err error) bool
- func LabelName(name string) func(ctx context.Context, item *cache.Item) string
- func LabelPreficKey(ctx context.Context, item *cache.Item) string
- func WithClearByContext(ctxKey interface{}) cache.Configure
- func WithClearByTTL() cache.Configure
- func WithFallback(fallback Fallback, isHandleFallback func(*cache.Item, error) bool) cache.Configure
- func WithLockGetter(getter Getter, isHandle func(*cache.Item, error) bool) cache.Configure
- func WithMetrics(m Metrics, labelCallback func(ctx context.Context, item *cache.Item) string) cache.Configure
- type Fallback
- type Getter
- type Metrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleByErr ¶
HandleByErr checks if cache return err.
func LabelPreficKey ¶
LabelPreficKey gets lebale by item prefix.
func WithClearByContext ¶
WithClearByContext clear cache if context done.
func WithClearByTTL ¶
WithClearByTTL clear cache by key after ttl.
func WithFallback ¶
func WithFallback(fallback Fallback, isHandleFallback func(*cache.Item, error) bool) cache.Configure
WithFallback sets fallback when cache handle success and set result in cache.
func WithLockGetter ¶ added in v0.2.0
WithLockGetter sets values from getter when cache handle success and set result in cache.
Types ¶
type Fallback ¶ added in v0.2.0
func LockFallback ¶
LockFallback locks run fallback by item key.
Click to show internal directories.
Click to hide internal directories.