redis

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisClient

type RedisClient struct {
	Redis *redis.Client
}

func NewRedisClient

func NewRedisClient(host string, port int, password string, db int) *RedisClient

func (*RedisClient) Delete

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

func (*RedisClient) Exists

func (s *RedisClient) Exists(ctx context.Context, key string) bool

func (*RedisClient) Get

func (s *RedisClient) Get(ctx context.Context, key string) ([]byte, error)

func (*RedisClient) GetBool

func (s *RedisClient) GetBool(ctx context.Context, key string) (bool, error)

func (*RedisClient) GetFloat

func (s *RedisClient) GetFloat(ctx context.Context, key string) (float64, error)

func (*RedisClient) GetInt

func (s *RedisClient) GetInt(ctx context.Context, key string) (int64, error)

func (*RedisClient) GetObject

func (s *RedisClient) GetObject(
	ctx context.Context,
	key string,
	obj interface{},
) error

func (*RedisClient) GetString

func (s *RedisClient) GetString(ctx context.Context, key string) (string, error)

func (*RedisClient) RemainingTime

func (s *RedisClient) RemainingTime(ctx context.Context, key string) time.Duration

Result: >= 0 remaining time -1 if the key exists but has no associated expire -2 if the key does not exist

func (*RedisClient) Set

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

Jump to

Keyboard shortcuts

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