redis

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: Apache-2.0 Imports: 5 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)

Check ...

func (*Store) Close

func (s *Store) Close() error

Close ...

func (*Store) Delete

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

Delete ...

func (*Store) EXP added in v1.0.7

func (s *Store) EXP(ctx context.Context, key string, expiration time.Duration) (bool, error)

EXP ...

func (*Store) Expire

func (s *Store) Expire(ctx context.Context, key string, expiration time.Duration) error

Expire ...

func (*Store) Get

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

Get ...

func (*Store) Set

func (s *Store) Set(ctx context.Context, key, value string, expiration time.Duration) error

Set ...

func (*Store) Set1

func (s *Store) Set1(ctx context.Context, key string, expiration time.Duration) error

Set1 ...

func (*Store) TTL added in v1.0.7

func (s *Store) TTL(ctx context.Context, key string) (time.Duration, bool, error)

TTL ...

Jump to

Keyboard shortcuts

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