cache

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheDb

type CacheDb struct {
	TimeOut    int64
	DbSet      bool
	SessionSet bool
	Db         HoTimeDBInterface
	*Error
	ContextBase
	// contains filtered or unexported fields
}

func (*CacheDb) Cache

func (that *CacheDb) Cache(key string, data ...interface{}) *Obj

func (*CacheDb) GetError

func (that *CacheDb) GetError() *Error

func (*CacheDb) SetError

func (that *CacheDb) SetError(err *Error)

type CacheIns

type CacheIns interface {
	//set(key string, value interface{}, time int64)
	//get(key string) interface{}
	//delete(key string)
	GetError() *Error
	SetError(err *Error)
	Cache(key string, data ...interface{}) *Obj
}

type CacheMemory

type CacheMemory struct {
	TimeOut    int64
	DbSet      bool
	SessionSet bool
	Map
	*Error
	ContextBase
	// contains filtered or unexported fields
}

func (*CacheMemory) Cache

func (that *CacheMemory) Cache(key string, data ...interface{}) *Obj

func (*CacheMemory) GetError

func (that *CacheMemory) GetError() *Error

func (*CacheMemory) SetError

func (that *CacheMemory) SetError(err *Error)

type CacheRedis

type CacheRedis struct {
	TimeOut    int64
	DbSet      bool
	SessionSet bool
	Host       string
	Pwd        string
	Port       int64

	ContextBase
	*Error
	// contains filtered or unexported fields
}

func (*CacheRedis) Cache

func (that *CacheRedis) Cache(key string, data ...interface{}) *Obj

func (*CacheRedis) GetError

func (that *CacheRedis) GetError() *Error

func (*CacheRedis) GetTag

func (that *CacheRedis) GetTag() int64

唯一标志

func (*CacheRedis) SetError

func (that *CacheRedis) SetError(err *Error)

type HoTimeCache

type HoTimeCache struct {
	*Error

	Config Map
	// contains filtered or unexported fields
}

HoTimeCache 可配置memory,db,redis,默认启用memory,默认优先级为memory>redis>db,memory与数据库缓存设置项一致, 缓存数据填充会自动反方向反哺,加入memory缓存过期将自动从redis更新,但memory永远不会更新redis,如果是集群建议不要开启memory,配置即启用

func (*HoTimeCache) Cache

func (that *HoTimeCache) Cache(key string, data ...interface{}) *Obj

func (*HoTimeCache) Db

func (that *HoTimeCache) Db(key string, data ...interface{}) *Obj

func (*HoTimeCache) Init

func (that *HoTimeCache) Init(config Map, hotimeDb HoTimeDBInterface, err ...*Error)

func (*HoTimeCache) Session

func (that *HoTimeCache) Session(key string, data ...interface{}) *Obj

type HoTimeDBInterface

type HoTimeDBInterface interface {
	GetPrefix() string
	Query(query string, args ...interface{}) []Map
	Exec(query string, args ...interface{}) (sql.Result, *Error)
	Get(table string, qu ...interface{}) Map
	Select(table string, qu ...interface{}) []Map
	Delete(table string, data map[string]interface{}) int64
	Update(table string, data Map, where Map) int64
	Insert(table string, data map[string]interface{}) int64
	GetType() string
}

Jump to

Keyboard shortcuts

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