memutils

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Log

func Log(w io.Writer, msg string)

func Now

func Now() int64

Types

type LazyScheduler

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

func NewLazyScheduler

func NewLazyScheduler(driver MemDriver) *LazyScheduler

func (*LazyScheduler) After

func (ls *LazyScheduler) After(duration time.Duration, call *LazySchedulerCall)

func (*LazyScheduler) Exec

func (ls *LazyScheduler) Exec(call *LazySchedulerCall) (err error)

func (*LazyScheduler) GenerateKey

func (ls *LazyScheduler) GenerateKey(timestamp int64) string

func (*LazyScheduler) Recover

func (ls *LazyScheduler) Recover()

func (*LazyScheduler) Reg

func (ls *LazyScheduler) Reg(fnName string, handler LazySchedulerHandler)

type LazySchedulerCall

type LazySchedulerCall struct {
	ID   string
	Name string
	At   int64
	Args string
}

func LSC

func LSC(fnName string, args interface{}) *LazySchedulerCall

func (*LazySchedulerCall) Arg

func (lsc *LazySchedulerCall) Arg(to interface{})

type LazySchedulerHandler

type LazySchedulerHandler = func(*LazySchedulerCall)

type MemDriver

type MemDriver interface {
	Init(kargs ...string)

	Read(key string) (interface{}, bool)
	Write(key string, value interface{}, expire time.Duration, overwriteTTLIfExists bool) interface{}
	IncBy(key string, value int, expire time.Duration, overwriteTTLIfExists bool) int
	Inc(key string, expire time.Duration, overwriteTTLIfExists bool) int

	List(prefix string) []string
	Expire(key string)
	SetExpire(key string, duration time.Duration) time.Duration
	Exists(key string) bool
	Wipe(prefix string)
	WipePrefix(prefix string)
}

type MemDriverMemory

type MemDriverMemory struct {
	MemDriver
	// contains filtered or unexported fields
}

func (*MemDriverMemory) Exists

func (md *MemDriverMemory) Exists(key string) bool

func (*MemDriverMemory) Expire

func (md *MemDriverMemory) Expire(key string)

func (*MemDriverMemory) Inc

func (md *MemDriverMemory) Inc(key string, expire time.Duration, overwriteTTLIfExists bool) int

func (*MemDriverMemory) IncBy added in v1.9.2

func (md *MemDriverMemory) IncBy(key string, value int, expire time.Duration, overwriteTTLIfExists bool) int

func (*MemDriverMemory) Init

func (md *MemDriverMemory) Init(kargs ...string)

func (*MemDriverMemory) List

func (md *MemDriverMemory) List(key string) []string

func (*MemDriverMemory) Read

func (md *MemDriverMemory) Read(key string) (interface{}, bool)

func (*MemDriverMemory) SetExpire added in v1.14.0

func (md *MemDriverMemory) SetExpire(key string, duration time.Duration) time.Duration

func (*MemDriverMemory) Wipe added in v1.9.2

func (md *MemDriverMemory) Wipe(prefix string)

func (*MemDriverMemory) WipePrefix added in v1.14.0

func (md *MemDriverMemory) WipePrefix(prefix string)

func (*MemDriverMemory) Write

func (md *MemDriverMemory) Write(key string, value interface{}, expire time.Duration, overwriteTTLIfExists bool) interface{}

type MemDriverRedis

type MemDriverRedis struct {
	MemDriver
	// contains filtered or unexported fields
}

func (*MemDriverRedis) Exists

func (md *MemDriverRedis) Exists(key string) bool

func (*MemDriverRedis) Expire

func (md *MemDriverRedis) Expire(key string)

func (*MemDriverRedis) Inc

func (md *MemDriverRedis) Inc(key string, expire time.Duration, overwriteTTLIfExists bool) int

func (*MemDriverRedis) IncBy added in v1.9.2

func (md *MemDriverRedis) IncBy(key string, value int, expire time.Duration, overwriteTTLIfExists bool) int

func (*MemDriverRedis) Init

func (md *MemDriverRedis) Init(kargs ...string)

func (*MemDriverRedis) List

func (md *MemDriverRedis) List(prefix string) []string

func (*MemDriverRedis) Read

func (md *MemDriverRedis) Read(key string) (interface{}, bool)

func (*MemDriverRedis) SetExpire added in v1.14.0

func (md *MemDriverRedis) SetExpire(key string, duration time.Duration) time.Duration

func (*MemDriverRedis) Wipe added in v1.9.2

func (md *MemDriverRedis) Wipe(prefix string)

func (*MemDriverRedis) WipePrefix added in v1.14.0

func (md *MemDriverRedis) WipePrefix(prefix string)

func (*MemDriverRedis) Write

func (md *MemDriverRedis) Write(key string, value interface{}, expire time.Duration, overwriteTTLIfExists bool) interface{}

Jump to

Keyboard shortcuts

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