redis

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ES日志开关 = "es:log:switch:"
)

Variables

This section is empty.

Functions

func DecrBy

func DecrBy(key string, n int64) int64

func Del

func Del(ks ...string) (int64, error)

func Exists

func Exists(key string) bool

func Expire

func Expire(k string, t int64) bool

func Get

func Get(key string) []byte

func GetString

func GetString(key string) string

func HGet

func HGet(k, i string) (string, error)

HGet 从hash中获取值

func HGetAll

func HGetAll(k string) (map[string]string, error)

HGetAll 从hash中获key所有的取值

func HMSet

func HMSet(k string, fields map[string]interface{}, timeoutSecond int) error

HMSet 向一张hash表中放入数据,如果不存在将创建

func HMget

func HMget(k string, is ...string) ([]interface{}, error)

func Hdel

func Hdel(k string, is ...string) (int64, error)

Hdel 从hash中删除

func Hset

func Hset(k, i, v string, timeoutSecond int) error

Hset 向一张hash表中放入数据,如果不存在将创建

func Incr

func Incr(key string) int64

func IncrBy

func IncrBy(key string, n int64) int64

func Init

func Init()

func Lock

func Lock(k, uniqueValue string, timeoutSecond int) bool

Lock 抢锁。抢到锁返回true,否则false。只抢一次 所有参数必传,超时时间单位秒

func LockWait

func LockWait(k, uniqueValue string, timeoutSecond int, lockTimeoutSecond int) bool

LockWait 抢锁,在规定的时间内直到抢锁成功或者超时失败。抢到锁返回true,否则false k 必须 uniqueValue 必须 timeoutSecond 锁自动释放时间,必须 lockTimeoutSecond 抢锁超时时间,默认1分钟

func Set

func Set(k, v string) error

func SetNx

func SetNx(k, v string, timeoutSecond int) error

func SwitchOpen

func SwitchOpen(key string) bool

SwitchOpen 在redis中存0或1,1代表OK

func TestLog

func TestLog()

func Unlock

func Unlock(k, uniqueValue string) bool

Unlock 解锁 所有参数必传

func ZAdd added in v0.0.11

func ZAdd(k, v string, score float64) (interface{}, error)

func ZCard added in v0.0.11

func ZCard(k string) (interface{}, error)

func ZRank added in v0.0.11

func ZRank(k, v string) (interface{}, error)

func ZRem added in v0.0.13

func ZRem(k, v string) (interface{}, error)

func ZRemRangeByScore added in v0.0.11

func ZRemRangeByScore(k string, min, max string) (interface{}, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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