util

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultReapInterval = time.Second
)

Variables

This section is empty.

Functions

func SampleIndices

func SampleIndices(sliceLen int, count int) []int

Types

type Cache

type Cache struct {
	ReaperFunc   OnRemove
	ReapInterval time.Duration
	// contains filtered or unexported fields
}

func NewCache

func NewCache() *Cache

func (*Cache) Del

func (l *Cache) Del(key string)

func (*Cache) Get

func (l *Cache) Get(key string) interface{}

func (*Cache) Has

func (l *Cache) Has(key string) bool

func (*Cache) Set

func (l *Cache) Set(key string, val interface{}, expMS int64)

type MultiLocker

type MultiLocker interface {
	TryLock(interface{}) bool
	TryRLock(interface{}) bool
	Unlock(interface{})
	RUnlock(interface{})
}

func NewMultiLocker

func NewMultiLocker() MultiLocker

type Observable

type Observable struct {
	// contains filtered or unexported fields
}

func NewObservable

func NewObservable() *Observable

func (*Observable) Emit

func (o *Observable) Emit(evt string, args ...interface{})

func (*Observable) On

func (o *Observable) On(evt string, cb interface{}) func()

type OnRemove

type OnRemove func(key string, val interface{})

type Unsubscriber

type Unsubscriber func()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL