redis

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(key string) error

Delete 删除

func Expire

func Expire(key string, t int64) error

Expire 失效时间配置

func Get

func Get(key string) interface{}

Get 获取一个值

func GetBytes

func GetBytes(key *string) (*[]byte, error)

GetBytes 获取一个字节数组值

func Init

func Init(opts *Config) error

Init init

func IsExist

func IsExist(key string) bool

IsExist 判断key是否存在

func Set

func Set(key string, val interface{}, timeout time.Duration) error

设置一个值

func SetAdd added in v1.0.5

func SetAdd(key string, data ...interface{}) error

集合Set增加元素

func SetBytes added in v1.0.5

func SetBytes(key *string, data *[]byte, timeout time.Duration) error

func SetIsMember added in v1.0.5

func SetIsMember(key string, member interface{}) (interface{}, error)

集合Set判断是否存在成员member,结果.(int64)==1表示存在

func SetRem added in v1.0.5

func SetRem(key string, data ...interface{}) error

集合Set删除元素

Types

type Config

type Config struct {
	Host        string `yml:"host" json:"host"`
	Password    string `yml:"password" json:"password"`
	Database    int    `yml:"database" json:"database"`
	MaxIdle     int    `yml:"max_idle" json:"max_idle"`
	MaxActive   int    `yml:"max_active" json:"max_active"`
	IdleTimeout int    `yml:"idle_timeout" json:"idle_timeout"` //second
}

Config 配置

Jump to

Keyboard shortcuts

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