redis

package
v0.0.0-...-e120e2b Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConfig

func InitConfig(c Config)

func InitKeyStruct

func InitKeyStruct(v interface{}, upper bool, prefix ...string)

Types

type ClientInterface

type ClientInterface interface {
	SetString(ctx context.Context, key Key, v string, expiration ...time.Duration) error
	GetString(ctx context.Context, key Key) (string, error)
	SetInt64(ctx context.Context, key Key, v int64, expiration ...time.Duration) error
	GetInt64(ctx context.Context, key Key) (int64, error)
	SetObject(ctx context.Context, key Key, v interface{}, expiration ...time.Duration) error
	GetObject(ctx context.Context, key Key, out interface{}) error
	SetBool(ctx context.Context, key Key, v bool, expiration ...time.Duration) error
	GetBool(ctx context.Context, key Key) (bool, error)
	Delete(ctx context.Context, key ...Key) error
	Exists(ctx context.Context, key ...Key) (bool, error)
	IncBy(ctx context.Context, key Key, value int64) error
	IncByFloat64(ctx context.Context, key Key, value float64) error

	HSetString(ctx context.Context, key Key, field Key, v string) error
	HGetString(ctx context.Context, key Key, field Key) (string, error)
	HSetInt64(ctx context.Context, key Key, field Key, v int64) error
	HGetInt64(ctx context.Context, key Key, field Key) (int64, error)
	HSetObject(ctx context.Context, key Key, field Key, v interface{}) error
	HGetObject(ctx context.Context, key Key, field Key, out interface{}) error
	HSetBool(ctx context.Context, key Key, field Key, v bool) error
	HGetBool(ctx context.Context, key Key, field Key) (bool, error)
	HDelete(ctx context.Context, key Key, field Key) error
	HExists(ctx context.Context, key Key, field Key) (bool, error)
	HIncBy(ctx context.Context, key Key, field Key, value int64) error
	HIncByFloat64(ctx context.Context, key Key, field Key, value float64) error

	Expire(ctx context.Context, key Key, expiration time.Duration) error

	Publish(ctx context.Context, key Key, v interface{}) error
	Subscription(ctx context.Context, key Key, onMessage func(msg string))
}

func Client

func Client() ClientInterface

func NewClient

func NewClient(config Config) ClientInterface

type Config

type Config struct {
	UsePass bool
	Host    string
	User    string
	Pass    string
	Port    int
	Index   int
}

type Key

type Key string

func (Key) Prefix

func (t Key) Prefix(v ...string) Key

func (Key) String

func (t Key) String() string

func (Key) Suffix

func (t Key) Suffix(v ...string) Key

Jump to

Keyboard shortcuts

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