redis

package
v0.0.0-...-89311fe Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRedis

func InitRedis() error

func Ping

func Ping(ctx context.Context) error

Types

type Redis

type Redis struct {
	Config *redis.Options
	Client *redis.Client
}

Redis provides a cache backed by a Redis server.

func GetRedis

func GetRedis() (*Redis, error)

func New

func New(config *redis.Options) *Redis

New returns an initialized Redis cache object.

func (*Redis) HDel

func (r *Redis) HDel(ctx context.Context, key string, field ...string) error

func (*Redis) HGet

func (r *Redis) HGet(ctx context.Context, key, field string) (string, error)

func (*Redis) HGetAll

func (r *Redis) HGetAll(ctx context.Context, key string) (map[string]string, error)

func (*Redis) HSet

func (r *Redis) HSet(ctx context.Context, key, field, value string, expire time.Duration) error

func (*Redis) HSetNX

func (r *Redis) HSetNX(ctx context.Context, key, field, value string, expire time.Duration) error

func (*Redis) Ping

func (r *Redis) Ping(ctx context.Context) error

func (*Redis) TTL

func (r *Redis) TTL(ctx context.Context, key string) (time.Duration, error)

type RedisConfigItem

type RedisConfigItem struct {
	Address  string `json:"address"`
	Password string `json:"password"`
	DB       int32  `json:"db"`
}

Jump to

Keyboard shortcuts

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