redis

package
v0.0.0-...-6dcb45d Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: MIT, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNil = redis.ErrNil

Functions

func Close

func Close()

func Delete

func Delete(key string) error

func Exists

func Exists(key string) (bool, error)

func Get

func Get(key string) ([]byte, error)

func HDelete

func HDelete(name, key string) error

func HExists

func HExists(name, key string) (bool, error)

func HGet

func HGet(name, key string) ([]byte, error)

func HGetall

func HGetall(name string) ([][]byte, error)

func HKeys

func HKeys(name string) ([]string, error)

func HSet

func HSet(name, key string, data interface{}) error

func HVals

func HVals(name string) ([][]byte, error)

func Init

func Init(host, auth string, db, maxActive, maxIdle, idleTimeout int) error

初始化默认数据库,全局唯一的,用包名访问的方法,都存在此数据库中。

func Keys

func Keys(key string) ([]string, error)

func Set

func Set(key string, data interface{}) error

func SetEx

func SetEx(key string, timeout int, data interface{}) (err error)

Types

type Redis

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

func GetDefaultDB

func GetDefaultDB() *Redis

获取默认数据库。

func NewRedis

func NewRedis(host, auth string, db, maxActive, maxIdle, idleTimeout int) (*Redis, error)

新打开一个数据库对象,如果程序中需要同时打开多个数据库,则可以用此方法。

func (*Redis) Close

func (r *Redis) Close()

func (*Redis) Delete

func (r *Redis) Delete(key string) error

func (*Redis) Exists

func (r *Redis) Exists(key string) (bool, error)

func (*Redis) Get

func (r *Redis) Get(key string) ([]byte, error)

func (*Redis) HDelete

func (r *Redis) HDelete(name, key string) error

func (*Redis) HExists

func (r *Redis) HExists(name, key string) (bool, error)

func (*Redis) HGet

func (r *Redis) HGet(name, key string) ([]byte, error)

func (*Redis) HGetall

func (r *Redis) HGetall(name string) ([][]byte, error)

func (*Redis) HGetallToMap

func (r *Redis) HGetallToMap(key string) (map[string]string, error)

func (*Redis) HKeys

func (r *Redis) HKeys(name string) ([]string, error)

func (*Redis) HSet

func (r *Redis) HSet(name, key string, data interface{}) (err error)

func (*Redis) HVals

func (r *Redis) HVals(name string) ([][]byte, error)

func (*Redis) Keys

func (r *Redis) Keys(key string) ([]string, error)

func (*Redis) Set

func (r *Redis) Set(key string, data interface{}) (err error)

func (*Redis) SetEx

func (r *Redis) SetEx(key string, timeout int, data interface{}) (err error)

Jump to

Keyboard shortcuts

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