async

package module
v0.2.26 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const Unlimit = 0

Variables

This section is empty.

Functions

func All

func All(methods []LambdaMethod, timeout time.Duration) []interface{}

func Any

func Any(methods []LambdaMethod, timeout time.Duration) ([]interface{}, error)

func AnyOne

func AnyOne(methods []LambdaMethod, timeout time.Duration) (interface{}, []error)

func Call

func Call(m Method, timeout time.Duration, args ...interface{}) (interface{}, error)

func Flow

func Flow(enter Method, args []interface{}, methods []Method, timeout time.Duration) (interface{}, error)

func For added in v0.2.4

func For(count int, method func(int) (interface{}, error), maxConcurrent int) []interface{}

func ForceGet added in v0.2.6

func ForceGet(group string, key interface{}) (interface{}, error)

func ForceMGet added in v0.2.6

func ForceMGet(group string, keys ...interface{}) []interface{}

func Foreach added in v0.1.2

func Foreach(objs []interface{}, method func(int) (interface{}, error), maxConcurrent int) []interface{}

func Get added in v0.1.12

func Get(group string, key interface{}) (interface{}, error)

func Lambda

func Lambda(method func() (interface{}, error), timeout time.Duration) (interface{}, error)

func MGet added in v0.2.5

func MGet(group string, keys ...interface{}) []interface{}

func Parallel added in v0.0.2

func Parallel(methods []LambdaMethod, maxCount int) []interface{}

func RegisterGroup added in v0.1.12

func RegisterGroup(
	name string,
	batchSize int,
	method func(...interface{}) (map[interface{}]interface{}, error),
	cache CacheProvider) error

func Retry added in v0.0.9

func Retry(method func() (interface{}, error), maxCount int, interval time.Duration) (interface{}, error)

func Safety added in v0.0.5

func Safety(method func() (interface{}, error)) (res interface{}, err error)

func Serise

func Serise(methods []LambdaMethod, timeout time.Duration) []interface{}

func SetPanicHandler added in v0.0.2

func SetPanicHandler(hanlder func(interface{}))

Types

type CacheProvider added in v0.1.12

type CacheProvider interface {
	Put(string, interface{}, interface{}) error
	Get(string, interface{}) (interface{}, error)
}

type KVCache

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

func NewKVCache

func NewKVCache() *KVCache

func (*KVCache) Commit

func (kv *KVCache) Commit(method func(*KVData) (interface{}, error)) (interface{}, error)

func (*KVCache) Destory

func (kv *KVCache) Destory()

func (*KVCache) LRU added in v0.1.5

func (kv *KVCache) LRU(flag bool) *KVCache

func (*KVCache) MaxSize

func (kv *KVCache) MaxSize(maxSize int) *KVCache

func (*KVCache) TTL

func (kv *KVCache) TTL(ttl int64) *KVCache

type KVData

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

func (*KVData) Clean added in v0.0.2

func (kv *KVData) Clean()

func (*KVData) Del

func (kv *KVData) Del(key interface{})

func (*KVData) Get

func (kv *KVData) Get(key interface{}) (interface{}, error)

func (*KVData) Keys

func (kv *KVData) Keys() []interface{}

func (*KVData) MDel

func (kv *KVData) MDel(keys []interface{})

func (*KVData) MGet

func (kv *KVData) MGet(keys []interface{}) []interface{}

func (*KVData) MSet

func (kv *KVData) MSet(keys []interface{}, values []interface{})

func (*KVData) Merge

func (kv *KVData) Merge(pairs map[interface{}]interface{})

func (*KVData) Set

func (kv *KVData) Set(key interface{}, value interface{})

type LambdaMethod

type LambdaMethod func() (interface{}, error)

type Merge

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

func NewMerge

func NewMerge() *Merge

func (*Merge) Destory added in v0.0.8

func (m *Merge) Destory()

func (*Merge) Exec added in v0.0.8

func (m *Merge) Exec(key string, method func() (interface{}, error)) (interface{}, error)

type Method

type Method func(args ...interface{}) (interface{}, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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