internal

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CACHE_ROW_PLUGIN = "CACHE:ROW_PLUGIN"
)

Variables

This section is empty.

Functions

func InjectGorm

func InjectGorm(db *gorm.DB, opt *option.DefaultOption, redisOption *option.RedisOption) *plugin

InjectGorm .

Types

type Group

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

Group represents a class of work and forms a namespace in which units of work can be executed with duplicate suppression.

func (*Group) Do

func (g *Group) Do(key string, fn func() (interface{}, error)) (v interface{}, err error, shared bool)

Do executes and returns the results of the given function, making sure that only one execution is in-flight for a given key at a time. If a duplicate comes in, the duplicate caller waits for the original to complete and receives the same results. The return value shared indicates whether v was given to multiple callers.

func (*Group) DoChan

func (g *Group) DoChan(key string, fn func() (interface{}, error)) <-chan Result

DoChan is like Do but returns a channel that will receive the results when they are ready.

func (*Group) Forget

func (g *Group) Forget(key string)

Forget tells the singleflight to forget about a key. Future calls to Do for this key will call the function rather than waiting for an earlier call to complete.

type Handle

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

func (*Handle) Debug

func (h *Handle) Debug(item ...interface{})

func (*Handle) JoinAffectKey

func (h *Handle) JoinAffectKey(table string, key string) string

func (*Handle) JoinCountSecondKey

func (h *Handle) JoinCountSecondKey(key string) string

func (*Handle) JoinModelKey

func (h *Handle) JoinModelKey(table string, primary interface{}) string

func (*Handle) JoinModelKeys

func (h *Handle) JoinModelKeys(table string, primarys ...interface{}) []string

func (*Handle) JoinSearchKey

func (h *Handle) JoinSearchKey(table string, key string, indexKeys []interface{}) string

func (*Handle) NewCreateHandle

func (h *Handle) NewCreateHandle() *createHandle

func (*Handle) NewDeleteHandle

func (h *Handle) NewDeleteHandle() *deleteHandle

func (*Handle) NewQueryHandle

func (h *Handle) NewQueryHandle() *queryHandle

func (*Handle) NewUpdateHandle

func (h *Handle) NewUpdateHandle() *updateHandle

func (*Handle) RefreshEvent

func (h *Handle) RefreshEvent(key string, search bool)

func (*Handle) RefreshRun

func (h *Handle) RefreshRun()

type JsonModel

type JsonModel struct {
	PK    string
	Model interface{}
}

type JsonSearch

type JsonSearch struct {
	Timeout  int64
	Primarys []interface{}
}

type RedisClient

type RedisClient interface {
	Eval(script string, keys []string, args ...interface{}) *redis.Cmd
	EvalSha(sha1 string, keys []string, args ...interface{}) *redis.Cmd
	ScriptExists(hashes ...string) *redis.BoolSliceCmd
	ScriptLoad(script string) *redis.StringCmd
	Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd
	Del(keys ...string) *redis.IntCmd
	FlushDB() *redis.StatusCmd
	HGetAll(key string) *redis.StringStringMapCmd
	HDel(key string, fields ...string) *redis.IntCmd
	HScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd
	HGet(key, field string) *redis.StringCmd
	MGet(keys ...string) *redis.SliceCmd
	Expire(key string, expiration time.Duration) *redis.BoolCmd
	HSet(key, field string, value interface{}) *redis.BoolCmd
}

RedisClient .

type Result

type Result struct {
	Val    interface{}
	Err    error
	Shared bool
}

Result holds the results of Do, so they can be passed on a channel.

Jump to

Keyboard shortcuts

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