Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultKVFn(table string, kvs map[string]interface{}) string
- func DefaultKeyFn(table string, id interface{}) string
- type RedisedMysql
- func (r *RedisedMysql) ClearCache(table string, ids ...int)
- func (r *RedisedMysql) Close()
- func (r *RedisedMysql) DelCacheList(table string, kvs map[string]interface{})
- func (r *RedisedMysql) DelCacheListArgs(table string, kvs ...interface{})
- func (r *RedisedMysql) Get(result interface{}, table, idField string, id interface{})
- func (r *RedisedMysql) GetByKvs(result interface{}, table, idField string, kvs map[string]interface{})
- func (r *RedisedMysql) List(result interface{}, table, idField string, ids []int)
- func (r *RedisedMysql) ListByKvs(result interface{}, table, idField string, kvs map[string]interface{})
- func (r *RedisedMysql) ListBySql(result interface{}, key string, query string, args ...interface{})
- func (r *RedisedMysql) ListBySqlIntoMap(result interface{}, key, field string, query string, args ...interface{})
Constants ¶
View Source
const (
ErrorInit = 1 + iota
)
Variables ¶
View Source
var DefaultTtl = 3600
Functions ¶
func DefaultKVFn ¶
map (table key value ...)-> redis key : table/k1/v1/k2/v2 order by keys
func DefaultKeyFn ¶
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
Click to show internal directories.
Click to hide internal directories.