Documentation ¶
Overview ¶
Package cache provides ready-to-use in-memory cache mechanisms
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultBigCacheConfig ¶
Types ¶
type EventWithContext ¶ added in v1.6.2
type EventWithContext struct { tree.NodeChangeEvent Ctx context.Context }
EventWithContext composes a NodeChangeEvent and a context
type EventsBatcher ¶ added in v1.6.2
type EventsBatcher struct { Events chan *EventWithContext Done chan bool // contains filtered or unexported fields }
EventsBatcher debounces events on a given timeframe and calls process on them afterward
func NewEventsBatcher ¶ added in v1.6.2
func NewEventsBatcher(ctx context.Context, debounce time.Duration, idle time.Duration, max int, process func(context.Context, *tree.NodeChangeEvent)) *EventsBatcher
NewEventsBatcher inits a new EventsBatcher
func (*EventsBatcher) Start ¶ added in v1.6.2
func (b *EventsBatcher) Start()
Start starts listening to incoming events
func (*EventsBatcher) Stop ¶ added in v1.6.2
func (b *EventsBatcher) Stop()
Stop stops listening to incoming events
type InstrumentedCache ¶
InstrumentCache wraps BigCache with metrics
func NewInstrumentedCache ¶
func NewInstrumentedCache(serviceName string, cacheConfig ...bigcache.Config) *InstrumentedCache
NewInstrumentedCache creates a BigCache instance with a regular report of statistics
func (*InstrumentedCache) Close ¶
func (i *InstrumentedCache) Close()
Close stops internal timer for reporting statistics
Click to show internal directories.
Click to hide internal directories.