redis

package
v0.0.0-...-b942761 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr      string // 地址(IP:Port)
	DB        int    // 数据库
	Password  string // 密码
	KeyPrefix string // 存储key的前缀
}

Config redis配置参数

type Store

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

Store redis存储

func NewStore

func NewStore(cfg *Config) *Store

NewStore 创建基于redis存储实例

func NewStoreWithClient

func NewStoreWithClient(cli *redis.Client, keyPrefix string) *Store

NewStoreWithClient 使用redis客户端创建存储实例

func NewStoreWithClusterClient

func NewStoreWithClusterClient(cli *redis.ClusterClient, keyPrefix string) *Store

NewStoreWithClusterClient 使用redis集群客户端创建存储实例

func (*Store) Check

func (s *Store) Check(ctx context.Context, key string) (bool, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, key string) error

func (*Store) Get

func (s *Store) Get(ctx context.Context, key string) interface{}

func (*Store) IsExist

func (s *Store) IsExist(ctx context.Context, key string) bool

func (*Store) Set

func (s *Store) Set(ctx context.Context, key string, v interface{}, expiration time.Duration) error

func (*Store) Xadd

func (s *Store) Xadd(ctx context.Context, key string, value interface{}) error

func (*Store) ZAdd

func (s *Store) ZAdd(ctx context.Context, key string, members ...redis.Z) (bool, error)

func (*Store) ZCount

func (s *Store) ZCount(ctx context.Context, key, min, max string) (int64, error)

func (*Store) ZIncrBy

func (s *Store) ZIncrBy(ctx context.Context, key string, increment float64, member string) (bool, error)

func (*Store) ZRange

func (s *Store) ZRange(ctx context.Context, key string, start, stop int64) ([]string, error)

func (*Store) ZRangeByScore

func (s *Store) ZRangeByScore(ctx context.Context, key string, opt *redis.ZRangeBy) ([]string, error)

func (*Store) ZRem

func (s *Store) ZRem(ctx context.Context, key string, members ...interface{}) (bool, error)

func (*Store) ZRemRangeByScore

func (s *Store) ZRemRangeByScore(ctx context.Context, key, min, max string) (bool, error)

func (*Store) ZRevRange

func (s *Store) ZRevRange(ctx context.Context, key string, start, stop int64) ([]string, error)

Jump to

Keyboard shortcuts

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