Documentation
¶
Overview ¶
Package cache provides ready-to-use in-memory cache mechanisms
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EventWithContext ¶
type EventWithContext struct { *tree.NodeChangeEvent Ctx context.Context }
EventWithContext composes a NodeChangeEvent and a context
type EventsBatcher ¶
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 ¶
func NewEventsBatcher(ctx context.Context, debounce time.Duration, idle time.Duration, max int, atomic bool, process func(context.Context, ...*tree.NodeChangeEvent)) *EventsBatcher
NewEventsBatcher initializes a new EventsBatcher
func (*EventsBatcher) Start ¶
func (b *EventsBatcher) Start()
Start starts listening to incoming events
type InstrumentedCache ¶
InstrumentedCache 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
func (*InstrumentedCache) Set ¶
func (i *InstrumentedCache) Set(key string, entry []byte) error
Set adds a key/value to the cache.
type KeyMutex ¶
type KeyMutex struct {
// contains filtered or unexported fields
}
KeyMutex allows locking resource by a unique ID instead of using a global lock
Source Files
¶
- bigcache.go
- event-batcher.go
- key_mutex.go
Click to show internal directories.
Click to hide internal directories.