redised

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorInit = 1 + iota
)

Variables

View Source
var DefaultTtl = 3600

Functions

func DefaultKVFn

func DefaultKVFn(table string, kvs map[string]interface{}) string

map (table key value ...)-> redis key : table/k1/v1/k2/v2 order by keys

func DefaultKeyFn

func DefaultKeyFn(table string, id interface{}) string

Types

type RedisedMysql

type RedisedMysql struct {
	Redis *rediswrap.Redis
	Mysql *mysqlwrap.Mysql
	KeyFn func(table string, id interface{}) string
	KVFn  func(table string, kvs map[string]interface{}) string
	Ttl   int
}

func NewRedisedMysql

func NewRedisedMysql(redis *rediswrap.Redis, mysql *mysqlwrap.Mysql) *RedisedMysql

func (*RedisedMysql) ClearCache

func (r *RedisedMysql) ClearCache(table string, ids ...int)

func (*RedisedMysql) Close

func (r *RedisedMysql) Close()

func (*RedisedMysql) DelCacheList added in v1.0.9

func (r *RedisedMysql) DelCacheList(table string, kvs map[string]interface{})

DelCacheList if we use listByXX method,we should clear cache in delete method

func (*RedisedMysql) DelCacheListArgs added in v1.0.9

func (r *RedisedMysql) DelCacheListArgs(table string, kvs ...interface{})

DelCacheList if we use listByXX method,we should clear cache in delete method

func (*RedisedMysql) Get

func (r *RedisedMysql) Get(result interface{}, table, idField string, id interface{})

func (*RedisedMysql) GetByKvs

func (r *RedisedMysql) GetByKvs(result interface{}, table, idField string, kvs map[string]interface{})

GetByKvs kv key -> id key -> result

func (*RedisedMysql) List

func (r *RedisedMysql) List(result interface{}, table, idField string, ids []int)

func (*RedisedMysql) ListByKvs

func (r *RedisedMysql) ListByKvs(result interface{}, table, idField string, kvs map[string]interface{})

ListByKvs kvs keys -> list -> values

func (*RedisedMysql) ListBySql

func (r *RedisedMysql) ListBySql(result interface{}, key string, query string, args ...interface{})

List result: eg. &[]table.User . redis -> set key result

func (*RedisedMysql) ListBySqlIntoMap

func (r *RedisedMysql) ListBySqlIntoMap(result interface{}, key, field string, query string, args ...interface{})

ListBySqlHash set list result to redis map . redis -> hset key field result

Jump to

Keyboard shortcuts

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