redis

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BitCount added in v0.0.7

func BitCount(ctx context.Context, client redis.Cmdable, key string) (count int64, err error)

func Del added in v0.0.7

func Del(ctx context.Context, client redis.Cmdable, key string) (count int, err error)

func DelPattern added in v0.0.7

func DelPattern(ctx context.Context, client redis.Cmdable, database int, pattern string) (count int, err error)

func Exists added in v0.0.7

func Exists(ctx context.Context, client redis.Cmdable, key string) (res int64, err error)

func Expire added in v0.0.7

func Expire(ctx context.Context, client redis.Cmdable, key string, expire int64) (res bool, err error)

Expire 让给定键在指定的秒数之后过期

func Get added in v0.0.7

func Get(ctx context.Context, client redis.Cmdable, key string) (value string, notFound bool, err error)

func HDel added in v0.0.7

func HDel(ctx context.Context, client redis.Cmdable, key string, field string) (err error)

func HGet added in v0.0.7

func HGet(ctx context.Context, client redis.Cmdable, key string, field string) (value string, notFound bool, err error)

func HSet added in v0.0.7

func HSet(ctx context.Context, client redis.Cmdable, key string, field string, value string) (err error)

func Info added in v0.0.7

func Info(ctx context.Context, client redis.Cmdable) (res string, err error)

func LPush added in v0.0.7

func LPush(ctx context.Context, client redis.Cmdable, key string, value string) (err error)

func LRem added in v0.0.7

func LRem(ctx context.Context, client redis.Cmdable, key string, count int64, value string) (err error)

func LSet added in v0.0.7

func LSet(ctx context.Context, client redis.Cmdable, key string, index int64, value string) (err error)

func MemoryUsage added in v0.0.7

func MemoryUsage(ctx context.Context, client redis.Cmdable, key string) (size int64, err error)

func Persist added in v0.0.7

func Persist(ctx context.Context, client redis.Cmdable, key string) (res bool, err error)

Persist 移除键的过期时间

func RPush added in v0.0.7

func RPush(ctx context.Context, client redis.Cmdable, key string, value string) (err error)

func SAdd added in v0.0.7

func SAdd(ctx context.Context, client redis.Cmdable, key string, value string) (err error)

func SRem added in v0.0.7

func SRem(ctx context.Context, client redis.Cmdable, key string, value string) (err error)

func Set added in v0.0.7

func Set(ctx context.Context, client redis.Cmdable, key string, value string) (err error)

func SetBit added in v0.0.7

func SetBit(ctx context.Context, client redis.Cmdable, key string, offset int64, value int) (err error)

func TTL added in v0.0.7

func TTL(ctx context.Context, client redis.Cmdable, key string) (res int64, err error)

TTL 查看给定键距离过期还有多少秒

func ValueType added in v0.0.7

func ValueType(ctx context.Context, client redis.Cmdable, key string) (ValueType string, err error)

Types

type ClusterService added in v0.0.7

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

func (*ClusterService) BitCount added in v0.0.8

func (this_ *ClusterService) BitCount(param *Param, key string) (count int64, err error)

func (*ClusterService) Del added in v0.0.7

func (this_ *ClusterService) Del(param *Param, key string) (count int, err error)

func (*ClusterService) DelPattern added in v0.0.7

func (this_ *ClusterService) DelPattern(param *Param, pattern string) (count int, err error)

func (*ClusterService) Exists added in v0.0.7

func (this_ *ClusterService) Exists(param *Param, key string) (res int64, err error)

func (*ClusterService) Expire added in v0.0.7

func (this_ *ClusterService) Expire(param *Param, key string, expire int64) (res bool, err error)

func (*ClusterService) Get added in v0.0.7

func (this_ *ClusterService) Get(param *Param, key string) (value string, notFound bool, err error)

func (*ClusterService) GetClient added in v0.0.7

func (this_ *ClusterService) GetClient(param *Param) (client redis.Cmdable, err error)

func (*ClusterService) GetValueInfo added in v0.0.8

func (this_ *ClusterService) GetValueInfo(param *Param, key string, valueStart, valueSize int64) (valueInfo *ValueInfo, err error)

func (*ClusterService) HDel added in v0.0.7

func (this_ *ClusterService) HDel(param *Param, key string, field string) (err error)

func (*ClusterService) HGet added in v0.0.8

func (this_ *ClusterService) HGet(param *Param, key string, field string) (value string, notFound bool, err error)

func (*ClusterService) HSet added in v0.0.7

func (this_ *ClusterService) HSet(param *Param, key string, field string, value string) (err error)

func (*ClusterService) Info added in v0.0.7

func (this_ *ClusterService) Info(param *Param) (res string, err error)

func (*ClusterService) Keys added in v0.0.7

func (this_ *ClusterService) Keys(param *Param, pattern string, size int64) (keysResult *KeysResult, err error)

func (*ClusterService) LPush added in v0.0.7

func (this_ *ClusterService) LPush(param *Param, key string, value string) (err error)

func (*ClusterService) LRem added in v0.0.7

func (this_ *ClusterService) LRem(param *Param, key string, count int64, value string) (err error)

func (*ClusterService) LSet added in v0.0.7

func (this_ *ClusterService) LSet(param *Param, key string, index int64, value string) (err error)

func (*ClusterService) Persist added in v0.0.7

func (this_ *ClusterService) Persist(param *Param, key string) (res bool, err error)

func (*ClusterService) RPush added in v0.0.7

func (this_ *ClusterService) RPush(param *Param, key string, value string) (err error)

func (*ClusterService) SAdd added in v0.0.7

func (this_ *ClusterService) SAdd(param *Param, key string, value string) (err error)

func (*ClusterService) SRem added in v0.0.7

func (this_ *ClusterService) SRem(param *Param, key string, value string) (err error)

func (*ClusterService) Set added in v0.0.7

func (this_ *ClusterService) Set(param *Param, key string, value string) (err error)

func (*ClusterService) SetBit added in v0.0.8

func (this_ *ClusterService) SetBit(param *Param, key string, offset int64, value int) (err error)

func (*ClusterService) Stop added in v0.0.7

func (this_ *ClusterService) Stop()

func (*ClusterService) TTL added in v0.0.7

func (this_ *ClusterService) TTL(param *Param, key string) (res int64, err error)

type Config added in v0.0.8

type Config struct {
	Address  string `json:"address"`
	Auth     string `json:"auth"`
	Username string `json:"username"`
	CertPath string `json:"certPath"`
}

type IService

type IService interface {
	Stop()
	Info(param *Param) (res string, err error)
	Keys(param *Param, pattern string, size int64) (keysResult *KeysResult, err error)
	Expire(param *Param, key string, expire int64) (res bool, err error)
	TTL(param *Param, key string) (res int64, err error)
	Persist(param *Param, key string) (res bool, err error)
	Exists(param *Param, key string) (res int64, err error)
	GetValueInfo(param *Param, key string, valueStart, valueSize int64) (valueInfo *ValueInfo, err error)
	Set(param *Param, key string, value string) (err error)
	SAdd(param *Param, key string, value string) (err error)
	SRem(param *Param, key string, value string) (err error)
	LPush(param *Param, key string, value string) (err error)
	RPush(param *Param, key string, value string) (err error)
	LSet(param *Param, key string, index int64, value string) (err error)
	LRem(param *Param, key string, count int64, value string) (err error)
	HSet(param *Param, key string, field string, value string) (err error)
	HGet(param *Param, key string, field string) (value string, notFound bool, err error)
	HDel(param *Param, key string, field string) (err error)
	Del(param *Param, key string) (count int, err error)
	DelPattern(param *Param, pattern string) (count int, err error)
	SetBit(param *Param, key string, offset int64, value int) (err error)
	BitCount(param *Param, key string) (count int64, err error)
	Get(param *Param, key string) (value string, notFound bool, err error)
}

func New added in v0.0.8

func New(config Config) (service IService, err error)

New 创建Redis服务

func NewClusterService added in v0.0.8

func NewClusterService(servers []string, username string, auth string, certPath string) (IService, error)

NewClusterService 创建集群客户端

func NewRedisService added in v0.0.8

func NewRedisService(address string, username string, auth string, certPath string) (IService, error)

NewRedisService 创建客户端

type KeyInfo added in v0.0.7

type KeyInfo struct {
	Database int    `json:"database"`
	Key      string `json:"key"`
}

type KeysResult added in v0.0.7

type KeysResult struct {
	Count   int        `json:"count"`
	KeyList []*KeyInfo `json:"keyList"`
}

func ClusterKeys added in v0.0.7

func ClusterKeys(ctx context.Context, client *redis.ClusterClient, database int, pattern string, size int64) (keysResult *KeysResult, err error)

func Keys added in v0.0.7

func Keys(ctx context.Context, client redis.Cmdable, database int, pattern string, size int64) (keysResult *KeysResult, err error)

type Param added in v0.0.8

type Param struct {
	Ctx      context.Context
	Database int
}

type V8Service added in v0.0.7

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

func (*V8Service) BitCount added in v0.0.8

func (this_ *V8Service) BitCount(param *Param, key string) (count int64, err error)

func (*V8Service) Del added in v0.0.7

func (this_ *V8Service) Del(param *Param, key string) (count int, err error)

func (*V8Service) DelPattern added in v0.0.7

func (this_ *V8Service) DelPattern(param *Param, pattern string) (count int, err error)

func (*V8Service) Exists added in v0.0.7

func (this_ *V8Service) Exists(param *Param, key string) (res int64, err error)

func (*V8Service) Expire added in v0.0.7

func (this_ *V8Service) Expire(param *Param, key string, expire int64) (res bool, err error)

func (*V8Service) Get added in v0.0.7

func (this_ *V8Service) Get(param *Param, key string) (value string, notFound bool, err error)

func (*V8Service) GetClient added in v0.0.7

func (this_ *V8Service) GetClient(param *Param) (client redis.Cmdable, err error)

func (*V8Service) GetValueInfo added in v0.0.8

func (this_ *V8Service) GetValueInfo(param *Param, key string, valueStart, valueSize int64) (valueInfo *ValueInfo, err error)

func (*V8Service) HDel added in v0.0.7

func (this_ *V8Service) HDel(param *Param, key string, field string) (err error)

func (*V8Service) HGet added in v0.0.8

func (this_ *V8Service) HGet(param *Param, key string, field string) (value string, notFound bool, err error)

func (*V8Service) HSet added in v0.0.7

func (this_ *V8Service) HSet(param *Param, key string, field string, value string) (err error)

func (*V8Service) Info added in v0.0.7

func (this_ *V8Service) Info(param *Param) (res string, err error)

func (*V8Service) Keys added in v0.0.7

func (this_ *V8Service) Keys(param *Param, pattern string, size int64) (keysResult *KeysResult, err error)

func (*V8Service) LPush added in v0.0.7

func (this_ *V8Service) LPush(param *Param, key string, value string) (err error)

func (*V8Service) LRem added in v0.0.7

func (this_ *V8Service) LRem(param *Param, key string, count int64, value string) (err error)

func (*V8Service) LSet added in v0.0.7

func (this_ *V8Service) LSet(param *Param, key string, index int64, value string) (err error)

func (*V8Service) Persist added in v0.0.7

func (this_ *V8Service) Persist(param *Param, key string) (res bool, err error)

func (*V8Service) RPush added in v0.0.7

func (this_ *V8Service) RPush(param *Param, key string, value string) (err error)

func (*V8Service) SAdd added in v0.0.7

func (this_ *V8Service) SAdd(param *Param, key string, value string) (err error)

func (*V8Service) SRem added in v0.0.7

func (this_ *V8Service) SRem(param *Param, key string, value string) (err error)

func (*V8Service) Set added in v0.0.7

func (this_ *V8Service) Set(param *Param, key string, value string) (err error)

func (*V8Service) SetBit added in v0.0.8

func (this_ *V8Service) SetBit(param *Param, key string, offset int64, value int) (err error)

func (*V8Service) Stop added in v0.0.7

func (this_ *V8Service) Stop()

func (*V8Service) TTL added in v0.0.7

func (this_ *V8Service) TTL(param *Param, key string) (res int64, err error)

type ValueInfo added in v0.0.7

type ValueInfo struct {
	Database    int         `json:"database"`
	Key         string      `json:"key"`
	ValueType   string      `json:"valueType"`
	Value       interface{} `json:"value"`
	ValueCount  int64       `json:"valueCount"`
	ValueStart  int64       `json:"valueStart"`
	ValueEnd    int64       `json:"valueEnd"`
	Cursor      uint64      `json:"cursor"`
	MemoryUsage int64       `json:"memoryUsage"`
	TTL         int64       `json:"ttl"`
}

func GetValueInfo added in v0.0.8

func GetValueInfo(ctx context.Context, client redis.Cmdable, database int, key string, valueStart, valueSize int64) (valueInfo *ValueInfo, err error)

Jump to

Keyboard shortcuts

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