Documentation ¶
Index ¶
- Variables
- func RegisterDb(aliasName string, driverType DriverType, host, pwd string, params ...int) error
- type Database
- type DriverType
- type HVal
- type RedisDB
- func (cache *RedisDB) Close() error
- func (cache *RedisDB) Del(Prefix, key string) (int64, error)
- func (cache *RedisDB) Exists(Prefix, key string) (bool, error)
- func (cache *RedisDB) Expire(Prefix, key string, expireSecond int) (int64, error)
- func (cache *RedisDB) HDel(Prefix, key string, fields ...string) (int64, error)
- func (cache *RedisDB) HExist(Prefix, key, field string) (bool, error)
- func (cache *RedisDB) HGetAll(Prefix string, key string) (map[string]string, error)
- func (cache *RedisDB) HGetVals(Prefix, key string) ([]string, error)
- func (cache *RedisDB) HGetValsByMulKey(Prefix string, keys ...string) (hv []HVal, err error)
- func (cache *RedisDB) HSet(Prefix, key, field string, value interface{}) (int64, error)
- func (cache *RedisDB) HSetExpire(Prefix, key, field, data string, expireSecond int) (int64, error)
- func (cache *RedisDB) Open(settings *connectionURL) error
- func (cache *RedisDB) SGet(Prefix, key string) (string, error)
- func (cache *RedisDB) SSet(Prefix, key string, value interface{}, expireSecond int) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDbNotFound = errors.New("Cache: The database to be closed does not exist") ErrAliasNotExist = errors.New("Cache: The specified alias does not exist") ErrDriverTypeNotFound = errors.New("Cache: Driver Type does not exist") ErrPoolDisconnected = errors.New("Cache: Connection pool has been disconnected") ErrNotHaveAvailableConn = errors.New("Cache: No connections available") ErrValueNotBeenNil = errors.New("Cache: Value cannot be empty") ErrKeyNotBeenNil = errors.New("Cache: Key cannot be empty") ErrHashScan = errors.New("Cache: Wrong hash structure") ErrScanStructValue = errors.New("Cache: value must be non-nil pointer to a struct") )
View Source
var EnableCache bool
是否启用缓存,默认为true
Functions ¶
func RegisterDb ¶
func RegisterDb(aliasName string, driverType DriverType, host, pwd string, params ...int) error
Types ¶
type Database ¶
type Database interface { Open(settings *connectionURL) error Close() error //判断key是否存在 Exists(Prefix, key string) (bool, error) Expire(Prefix, key string, expireSecond int) (int64, error) SGet(Prefix, key string) (string, error) SSet(Prefix, key string, value interface{}, expireSecond int) error Del(Prefix, key string) (int64, error) HSet(Prefix, key, field string, value interface{}) (int64, error) HSetExpire(Prefix, key, field, data string, expireSecond int) (int64, error) //HGetVals Redis Hvals 命令返回哈希表所有域(field)的值。 HGetVals(Prefix, key string) ([]string, error) HGetAll(Prefix string, key string) (map[string]string, error) HGetValsByMulKey(Prefix string, keys ...string) (hv []HVal, err error) HDel(Prefix, key string, fields ...string) (int64, error) HExist(Prefix, key string, fields string) (bool, error) }
type RedisDB ¶
type RedisDB struct {
// contains filtered or unexported fields
}
func (*RedisDB) HGetValsByMulKey ¶
hash bucket: get all values,each with field,value
func (*RedisDB) HSetExpire ¶
hash bucket:set ,with expiration
Source Files ¶
Click to show internal directories.
Click to hide internal directories.